openapi2conv: convert references in nested additionalProperties schemas#1047
Merged
fenollp merged 2 commits intogetkin:masterfrom Dec 24, 2024
Merged
Conversation
When the schema specified in additionalProperties contains another nested schema with additionalProperties, the references must be converted at all of levels of the nested schemas.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
additionalPropertiescontains 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
additionalPropertieswas 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
additionalPropertiesthat 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.