-
-
Notifications
You must be signed in to change notification settings - Fork 528
feat: document polymorphic [null
, string
] type non spec-compliant output
#1197
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
Comments
Hm at this point, I can’t remember the exact reason for that. OpenAPI 3.x prefers As a temporary workaround, again, |
However, if using openapi-typescript, this changes generated code from:
to
We may want a separate issue for this, but why does |
Beside @tyronen9 The example you mention is about prop with If so it might worth opening another issue/PR extending the tests I've added in this PR which tries to address the initial issue. About @drwpow If you decided to consider this PR I'd happy to extend its test to make sure we don't introduce regression bug. Feel free to comment it and propose extra test cases. |
This looks good to me. I believe if this does change behavior for some people, it’s a desirable change. I’m not aware off the top of my head of any regressions this would likely cause. Overall this seems like an improvement. |
Description
I've recently run into a probably known issue related to polymorphic object definitions returning an unexpected empty string value in the resulting union type:
...resulting into:
I've found this behaviour documented as expected in the tests:
https://github.com/drwpow/openapi-typescript/blob/c732542df136eee2f41d242321758a0901b45248/packages/openapi-typescript/test/schema-object.test.ts#L283
Proposal
I'm writing to ask:
Happy to open a PR in case maintainers decided to consider fixing this, instead.
Thanks for the outstanding work here!
Checklist
The text was updated successfully, but these errors were encountered: