openapi2conv: convert references in nested additionalProperties schemas #1047
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the schema specified in
additionalProperties
contains another nested schema withadditionalProperties
, the schema references must be converted at all of levels of the nested schemas.The following examples illustrate the problem. This pull request fixes the issue by traversing all of the nested schemas in
additionalProperties
, making copies of the objects that are modified by the conversion.Prior to this change, a schema reference is specified in a top-level
additionalProperties
was being converted correctly. In the following example OpenAPI 2.0 definition, the reference to "#/definitions/Foo" is correctly converted to "#/components/schemas/Foo" in the OpenAPI 3.0 definition that is produced.When there is a schema reference in an
additionalProperties
that is nested in the schema of anotheradditionalProperties
, then the conversion from OpenAPI 2.0 to OpenAPI 3.0 did not convert the schema reference to "#/components/schema/Foo". This case is fixed by this pull request.