-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate tags seen in Swagger Specification #1913
Comments
Could you share a reproducible example? That sounds like a bug if I'm understanding it correctly. |
Attached is the sample proto and swagger spec generated from that proto. Also let me know how to disable tags getting added for unannotated service names in proto file |
I tried generating a swagger file using {
"swagger": "2.0",
"info": {
"title": "test.proto",
"version": "version not set"
},
"tags": [
{
"name": "UserManagement"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"typeUrl": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
},
"usersResponse": {
"type": "object",
"properties": {
"status": {
"type": "string"
}
}
}
}
} Note that it has no services since you haven't set any http.proto annotations in your protofile. I also notice a single tag. So I'm not sure where that YAML file is coming from, but |
HI, Attached is the yaml file with http rules, Command used for the swagger generation: |
I ran the generation command and this is my output:
Is this incorrect? It looks fine to me, one top level tag and then the tags used within each message. How are you generating the |
Yes, thats the problem. Have you tried integrating above specification to swagger UI? I have integrated the above open API spec to swagger editor and attached is the screenshot of the same, We have one top level tag and tag used by each API. Thats not looking correct, duplicate top level tag is visible. |
Ah, I see, one of them has a space and one of them doesn't. Would it be okay for you to change your tag to |
Hi, But we want to use customized tag names and split APIs based on the customized tag under the same service in the proto file. This issue is not seen in a_bit_of_everything.proto file. Can you check once from your side? |
I don't think we support not generating a tag per-service, which seems to be what you're asking for here? Would this be fixed by simply post-processing the swagger.json output? Presumably all you need to do is drop the |
Yes, We will do post-processing to drop service name tags. Thanks |
Hi,
I could see some duplicate tags in the open api spec inspite of custom tag names being added to all the rpcs under the service.
Service name tag seems to be a duplicate one. How to remove that tag from the open API spec?
Also, we don't want tags to be appearing in spec for services with no annotations. How to remove the tag name for services with no bindings in the proto?
The text was updated successfully, but these errors were encountered: