-
-
Notifications
You must be signed in to change notification settings - Fork 411
Support v3.1 typed arrays #1167
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
base: main
Are you sure you want to change the base?
Conversation
In OpenAPI v3.1 the nullable property was replaced with a "typed array", that is an array that can either be of type T or null. To make the minimal amount of changes this commit converts a type array back into what a 3.0 parser would expect. Closes acacode#991
|
@smorimoto any chance you could review this? We could really use this change. |
property.type = property.type[0]; | ||
property.nullable = true; | ||
} | ||
} |
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.
I had to add also this after your condition, to type array with single type work.
if (Array.isArray(property.type) && property.type.length == 1) { property.type = property.type[0]; }
Example yaml:
SomeType:
type:
- string
enum:
- one
- two
OtherComponent:
type: object
properties:
type:
$ref: '#/components/schemas/SomeType'
bugbot run |
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.
✅ Bugbot reviewed your changes and found no bugs!
Bugbot free trial expires on September 2, 2025
Learn more in the Cursor dashboard.
In OpenAPI v3.1 the nullable property was replaced with a "typed array", that is an array that can either be of type T or null.
To make the minimal amount of changes this commit converts a type array back into what a 3.0 parser would expect.
Closes #991