Improve SchemaObject interface by allowing ReferenceObject in some properties#76
Open
joelposti wants to merge 3 commits intoHilzu:masterfrom
Open
Improve SchemaObject interface by allowing ReferenceObject in some properties#76joelposti wants to merge 3 commits intoHilzu:masterfrom
joelposti wants to merge 3 commits intoHilzu:masterfrom
Conversation
…e ReferenceObject per OpenAPI specification.
Author
|
It seems tests do not pass after making these changes. I will fix the issue. |
added 2 commits
October 29, 2021 17:31
…nSchemaFields, walk and walkSchema: schema parameters can be ReferenceObjects as well as SchemaObjects.
Author
|
I fixed the issue. Tests pass now. |
Author
|
Hei @Hilzu! Could you take a look at this pull request? I would like to have this issue fixed here in the upstream. |
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.
Improved SchemaObject interface. Many of its properties can be of type ReferenceObject per OpenAPI specification.
Issue
Currently OpenAPI document that makes use of
$refin SchemaObjects do not pass TypeScript type checking because SchemaObject does not allow ReferenceObjects although the OpenAPI specification allows them. The following valid use cases of ReferenceObject do not pass type checking.Argument for the changes in this PR
The use cases demonstrated above should be valid according to OpenAPI specification at https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object and should thus pass type checking.
Explanation on the part of
propertiesleaves open the question whether individual properties can be ReferenceObjects. But I think they can because there is an example of such usage in the same specification document https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#simple-model.{ "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string" }, "address": { "$ref": "#/components/schemas/Address" }, "age": { "type": "integer", "format": "int32", "minimum": 0 } } }