-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
complex nullable type, change in behavior #536
Comments
@dylbarne Thank you for your report. 👍 Probably due to the v3.14.0 update. So the type generated when using
↓
|
so for some additional clarification/backstory, the actual source openapi.json document I am using in practice was generated through NSwag automatically, then I am consuming this to generate types for another project I do not have a reason to believe that the generated json input is incorrect (having same overall nullable nested type structure I gave in my sample), I would think the generated types behavior would be consistent for same original source json regardless of package version change and would not require any modification? |
The changes in v3.14.0 depend on the points made in #513 below. I am sure that this is a corrective change to this issue. And the bug in this issue was in the form of However, the generated type is inappropriate. The intent of the schema is that all types in There are many different ways of using |
I see, thank you for the additional information/clarification (and for creating this package in general ❤️) |
going from version
3.13.2
to3.14.0
(and beyond) I am seeing a difference in the generated d.ts file for nullable complex type.In earlier version, the dtsgen command will produce
enumSample?: LengthUom
, for new version(s) will generate intersectionenumSample?: null & (LengthUom)
The latter version causes an issue, since when attempting to use "enumSample" for valid
'Cm'
value ts-checking will give error "Type 'string' is not assignable to type 'null'."I have included simplified json contents that will reproduce behavior:
(enum was easiest example to show, but appears to be any class/type reference)
The text was updated successfully, but these errors were encountered: