-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Inconsistent undefined vs. null handling #926
Comments
Yes, the method may need both values with the following semantics:
|
So in Swagger-land you can have a parameter that
Correct? While TypeScript can reflect that, WebAPI doesn't I believe. |
In Web API you could have this operation i think:
I am not sure, but I think the following would apply with the TS client:
|
I see. The problem I have with this is that if the model's "no there"-type is I think having an option to have both nullable and optional parameter values be reflected as It technically excludes cases like the one you've given, but I for one wouldn't care. |
On additional related thing: On setting
This is undesirable as this means in fact If
Here, the |
I think theres also an option to not generate the ?, GenerateOptionalProperties? |
Seems the default value of I think the default should be made to be You get this typescript generated with the default of
This is for this C# class:
The problem is that with So I think the default should be I managed to switch to using
I have wondered if having a third option of eg. You can do this, and create sub-models and always be sure the names match the generated code.:
Typescript is amazing! |
Related: RicoSuter/NJsonSchema#882 (next version of nswag) |
@RicoSuter In case you weren't aware, the next version of typescript will be able to distinguish between With See also microsoft/TypeScript#13195 and microsoft/TypeScript#43947 Not sure of the exact consequences for nswag (if any), but thought you and others may be interested to see this. |
@simeyla : I don't think NSwag is impacted because it doesn't create object litterals, but instead serializes the function parameter. |
Optional values for
are correctly configurable with the
TypeScriptGeneratorSettings.NullHandling
setting.Parameter values, however, are always optional with
null
, never withundefined
.There is no deeper reason for this, is there?
The text was updated successfully, but these errors were encountered: