Closed scottwn closed 1 year ago
This PR fixes a bug in SwaggerRefHelper.
SwaggerRefHelper
When PayloadWrapperProcessor creates a "wrapped" definition, it sets it in the response property using setResponseSchema.
PayloadWrapperProcessor
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().
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.
getResponseSchema()
@bartoszm can I get a review on this?
Thank you @scottwn for the contribution.
This PR fixes a bug in
SwaggerRefHelper
.When
PayloadWrapperProcessor
creates a "wrapped" definition, it sets it in the response property usingsetResponseSchema
.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 deprecatedgetSchema()
.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 updatedgetResponseSchema()
to solve this problem.