-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
nullable property is not nullable in generated code #2055
Comments
Could you run your schema through Redocly’s validator, and confirm there are no schema issues? We do have tests in place for |
Here's an example. C# property is
swaggergen produces
and then openqpi-typescript produces
It seems to be the |
It is a breaking change that nullable properties with default values have their nullability changed. |
The option |
The issue is that this package targets openapi 3.1, which swashbuckle doesn't support. It ignores how openapi 3.0 generates it. I commented on another similar issue a while ago about this, but it went stale. I've discovered the cause of this, at least for my use case. My openapi spec is based off 3.0.1, and it uses the "nullable", which this package seems to ignore as it's marked as deprecated because it's not a concept in the 3.1 spec (presumably, I didn't dig into it more) This is the patch, which I didn't open a PR as there's probably other considerations.
|
Here is a property in my
swagger.json
Using
openapi-typescript
version6.7.6
this generatesBut using
openapi-typescript
version7.4.4
this generatesIt is good that the useless and annoying
?
has gone, but in the specification the property is nullable and therefore it is an error to have removed the| null
.The text was updated successfully, but these errors were encountered: