-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
Add option to generate all undefined as null or undefined. #2068
Comments
Running in the same issue |
Check your OpenAPI schema. Most likely your fields are marked as not required but not nullable. The generated TS types just reflect this by allowing undefined (since not required) but not null (since not nullable). In your case you'd want the fields to be required but nullable. Better to fix on the schema generating side... Annoying consequence of JS having both undefined and null. |
Could you give a reproduction of a schema you’re using, what’s being generated, and what you’d like to see instead? Without more information it’s impossible to know what’s happening here. |
If the issue is with an invalid schema, then there’s nothing we can do on our end.
This ticket tracker tracks issues with the openapi-typescript library, not other libraries, nor issues you’re experiencing. I’m going to close this, but if you have a valid schema, and there’s a bug in openapi-typescript, you can open as many new tickets as you find bugs 🙂 |
We believe we have an issue when generating from Python to TypeScript.
For some reason, the API may return
T | null
but the type generated usingopenapi-typescript
isT | undefined
Can we have an option to modify the output to allow both
T | null | undefined
?The text was updated successfully, but these errors were encountered: