Skip to content
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

swagger-servlet generating non-unique operationIds #1512

Closed
zyro23 opened this issue Oct 21, 2015 · 5 comments
Closed

swagger-servlet generating non-unique operationIds #1512

zyro23 opened this issue Oct 21, 2015 · 5 comments
Assignees
Labels
Milestone

Comments

@zyro23
Copy link

zyro23 commented Oct 21, 2015

using swagger-servlet-1.5.4.

first of all, @iushankin huuuge thanks for swagger-servlet migration with 1.5.4! works almost flawlessly.

i noticed that swagger-servlet will use @ApiOperations nickname attribute for path generation as well as for operationId.
however, it may be necessary to have multiple operations with the same path (but different http methods).
in this case, the nickname is correctly used multiple times as path for different operations but also as operationId which means the operationId is no longer unique.

as a result, swagger editor - for example - shows errors:

Cannot have multiple operations with the same operationId: /myPath

thanks, zyro

@webron
Copy link
Contributor

webron commented Oct 21, 2015

I believe the bug is that the field is used for path generation (if it's indeed used for that). Keeping the operationId/nickname unique is up to the user when it comes to servlets.

@zyro23
Copy link
Author

zyro23 commented Oct 21, 2015

just being curious - do you have another field in mind? currently, the method name is implemented as fallback if nickname is not set but that bears the same problem of being non-unique (across resources at least, ref. https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-servlet/src/main/java/io/swagger/servlet/extensions/ServletReaderExtension.java#L224).

@webron
Copy link
Contributor

webron commented Oct 21, 2015

You mean a fallback for the operationId generation? When it comes to servlets, it has to be the user responsibility. That said, the fallback should be to leave the operationId empty if it's a servlet, as the operationId in 2.0 is not a mandatory field.

By the way, thank you for providing the feedback on this module. @iushankin has done intense work on it! However, any initial release would have bugs in it and so opening tickets would really help us push a more stable module in the future.

@zyro23
Copy link
Author

zyro23 commented Oct 22, 2015

yes i meant as fallback for operationId "generation" or rather which annotation attributes could/should be used for path and/or operationId if those are handled seperately. did not know operationId is optional, so defaulting to an empty value is fine of course.

side-note reg. the migrated swagger-servlet module: currently using it successfully without jax-rs which means it is already working as i requested in #919. just awesome.

@webron
Copy link
Contributor

webron commented Oct 26, 2015

Okay, so we'll need to fix that point. The nickname should not be used for the path generation.

@webron webron added this to the v1.5.5 milestone Oct 26, 2015
@fehguy fehguy modified the milestones: v1.5.5, v1.5.6 Dec 23, 2015
@fehguy fehguy modified the milestones: v1.5.6, v1.5.7 Jan 6, 2016
@fehguy fehguy modified the milestones: v1.5.7, v1.5.8 Feb 5, 2016
fehguy added a commit that referenced this issue Feb 24, 2016
Fix #1512 - nickname not to be considered for path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants