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

merge java-methods only differing by mimetypes into one swagger-operation #101

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

MarkusKull
Copy link

Since some time ago, swagger-ui no longer displays methods having multiple differing return types. Only different produces-mimetypes with same return-type are supported. See OAI/OpenAPI-Specification#146 or swagger-api/swagger-core#521 .

Doclet can still support multiple java-methods (one java-method per mimetype) by combining them into one Swagger-Operation, which this PR does.
Unfortunately some doclet-unittests declare multiple methods with same parameters and mimetypes (invalid according to JAX-RS). As quick workaround any methods without mimetypes are omitted by the merge.

BTW, it would be nice to get rid of the (unused?) hashcode and equals-methods in the models. Hashing doesnt work well for changeable objects. I would also prefer immutable objects and empty collections instead of null collections.

… only multiple mimetypes.

Merge Operations only differing in mimetypes, else swagger-ui wont display them
@conorroche
Copy link

thanks markus looks good, there are some people still using java 7 so im thinking about doing a version of this fix that doesnt use lamdas etc, the equals is used in the unit tests for checking expected vs actual, agree re immutable models though there is some hackiness where some fields needed to be updated post creation but il look to address that properly at some stage, i would rather fix the unit tests that have the multiple methods with same path and mimetypes than have the workaround.

@MarkusKull
Copy link
Author

I'll probably have time in some days to look into the unittests and get rid of the workaround.

BTW, due to settings of maven-compiler in parentpom (source=target=1.8) the generated classfiles can no longer be run under java7. If you still want java7, this should be changed.

@MarkusKull
Copy link
Author

Did now fix the invalid UnitTest-Resources by assigning distinct paths. Removed the workaround.

@mageddo
Copy link

mageddo commented Feb 24, 2016

Ohh no, now the content-type is only one, if you have application/json and application/+1.json only one will be show

@MarkusKull
Copy link
Author

@mageddo Could you explain some more, e.g. with a complete example?

application/json and application/+1.json sounds like different versions or structurally different models. Such different structures are neither supported by swagger-spec or newest swagger-ui.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants