-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Migrate to OpenAPI 3.1 #5400
base: master
Are you sure you want to change the base?
Migrate to OpenAPI 3.1 #5400
Conversation
"summary": "Get crowdfund app data", | ||
"description": "Returns crowdfund app data", | ||
"summary": "Get crowdfunding app data", | ||
"description": "Returns crowdfunding app data", | ||
"responses": { | ||
"200": { | ||
"description": "Crowdfund app data", | ||
"description": "Crowdfunding app data", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one change is unrelated to the migration to OpenAPI 3.1. I just couldn't ignore it. "Crowdfunding app" sounds more natural. Feel free to revert this change if you disagree though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The swagger schema test fails. Please check CheckSwaggerIsConformToSchema
It looks like the Newtonsoft |
8cca9c0
to
147ea63
Compare
Rebased and tried to make the schema validation work by removing the |
147ea63
to
b03c102
Compare
@ai-oleynikov Any idea how we can resolve this? |
ping @ai-oleynikov still interested in helping with this one, if so can you check ^ |
Sorry for my disappearance! I'll work on fixing this today and report back if I have any issues I can't resolve. |
The problem seems to be that JSchema doesn't support the current version of the JSON Schema spec. https://www.jsonschemavalidator.net/ says the following
Therefore. it can't parse JSON Schema 2020-12. The error messages @dennisreimann shared above indicate that JSchema is unable to resolve references containing $defs, likely due to the changes in the behavior of $defs introduced in JSON Schema 2020-12. Unfortunately, the OpenAPI Initiative doesn't provide a JSON Schema for OpenAPI 3.1 using spec versions other than 2020-12. All their schema files are written using this version. I'm not sure what can be done here, except replacing JSchema with another JSON Schema validator that supports the current version of the spec 🤔 |
This package seems to support JSON Schema draft 2020-12: https://www.nuget.org/packages/JsonSchema.Net |
This PR updates OpenAPI version from 3.0 to 3.1 in accordance with this guide: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0
The only changes I made are:
"nullable": false
as this keyword is now deprecated, and nulls are rejected by default anyway"type": "<some-type>", "nullable": true
with"type": ["<some-type>", "null"]
"minimum": 0, "exclusiveMinimum": true
with"exclusiveMinimum": 0
"example"
with"examples"
keyword insideSchema Objects