-
-
Notifications
You must be signed in to change notification settings - Fork 506
Upgrade openapi to 3.1 #2614
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
Merged
Merged
Upgrade openapi to 3.1 #2614
Conversation
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
Collaborator
|
Nice looks like all tests are passing! |
Contributor
Author
|
Yep, hopefully this doesn't break stuff I'm not aware of :) |
melloware
approved these changes
Dec 6, 2025
Collaborator
|
Well we will find out I will do another RC release so we can test. |
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.
Major refactor changes
OpenAPI parsers, validators, loaders, upgraders, etc have all been switched to https://github.com/scalar/scalar
Input specs are upgraded to OpenAPI 3.1 and all functions get served OpenAPI 3.1 so no longer a mix of 3.0 and 3.1
All specs and schemas are no longer passed to functions along a spec key so they needed to pick the correct schema. Instead only the relevant spec and schema is passed to functions. Hopefully this makes things easier.
Example:
Note
SchemaObjectis union-typed with a boolean, this is because the OpenAPI spec allows for thisHowever this screws up the type. So in order to fix this a type-guard excluding the boolean must be used, and also handle the boolean case. Pretty annoying - but that's in spec.
A lot of types can be either "the thing" or a reference to a thing. We have
isReference(and still do) but now we also have{ isDereferenced } from '@scalar/openapi-types/helpers'which is the reverse, but gives better types then!isReferenceNullable types are now harder to "detected" thanks to OpenAPI 3.1
https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0
We need to do something better then what I did, because null is now in the type prop and it's an array and... and...
const isNullable = isArray(schema.type) && schema.type.includes('null')Caution
BREAKING CHANGES
InputFiltersOptionrenamedInputFiltersOptionsPlus I expect some regressions
FEATURES
--projectnow accepts a list of projects. Example:--project dogstore catstore