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

Replace getSchema() with getResponseSchema() in SwaggerRefHelper #61

Conversation

scottwn
Copy link
Contributor

@scottwn scottwn commented Jan 13, 2023

This PR fixes a bug in SwaggerRefHelper.

When PayloadWrapperProcessor creates a "wrapped" definition, it sets it in the response property using setResponseSchema.

https://github.com/bartoszm/yang2swagger/blob/4f513295e28612df4672b3ddb9ef8bc2456654b4/swagger-generator/src/main/java/com/mrv/yangtools/codegen/impl/postprocessor/PayloadWrapperProcessor.java#L63-L66

SwaggerRefHelper then attempts to retrieve the reference using the deprecated getSchema().

https://github.com/bartoszm/yang2swagger/blob/4f513295e28612df4672b3ddb9ef8bc2456654b4/swagger-generator/src/main/java/com/mrv/yangtools/codegen/impl/postprocessor/SwaggerRefHelper.java#L91

This causes yang2swagger to miss some references, and remove models that are in fact referenced in the generated swagger.

I am proposing a change to replace getSchema() with the updated getResponseSchema() to solve this problem.

@scottwn
Copy link
Contributor Author

scottwn commented Feb 7, 2023

@bartoszm can I get a review on this?

@bartoszm bartoszm self-requested a review April 6, 2023 08:24
@bartoszm
Copy link
Collaborator

bartoszm commented Apr 6, 2023

Thank you @scottwn for the contribution.

@bartoszm bartoszm closed this Apr 6, 2023
@bartoszm bartoszm reopened this Apr 6, 2023
@bartoszm bartoszm merged commit 44bceab into Amartus:master Apr 6, 2023
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.

2 participants