-
-
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
Optional property marked as required #3851
Comments
By setting |
This is a serious issue, has anyone looked at it? |
I've encountered this issue again when integrating a new API. The fix I've applied is pretty simple: Replace |
Same issue but with an api significant in size. Changing all of these by hand is not practical. At this point I may have to separate the work arounds into its own project. This whole thing desperately needs more dedicated maintainers. |
Might be able to utilize the ClientBaseClass property of CSharpClientGeneratorSettings to handle this issue instead of manually editing the generated classes.
|
Is there any update? Unfortunately it makes NSwag not useable anymore... or is there a propper workaround? -> (To manipulate the specs before is not an option) |
@Wangor No update I'm aware of unfortunately |
I'm finding this same issue. I guess there hasn't been a workaround? |
The workaround of @seansanchez did not work for me, but I managed to get it working using this code:
However, I strongly feel that RicoSuter/NJsonSchema#1563 would be the definitive fix for this issue, removing the need for this partial class. |
+1, hitting this issue for production clients and handling this issue in generated clients everytime is painful. Any update or ETA for fix? |
I'll repost the entire question posted on Stackoverflow as it looks like a NSwag issue.
Did I misconfigure something I've missed or is this an NSwag bug?
I'm using NSagStudio to generate a c# client for an OpenAPI 3.0.1 service. Since the latest update I get an issue where a property marked as required is missing from the retrieved data and thus cannot be deserialized.
I'm trying to understand if
OpenAPI 3.0.1 service spec: https://raw.githubusercontent.com/admin-ch/CovidCertificate-Apidoc/main/open-api/api-doc.yaml
NSwagStudio configuration:
My issue occurs with this element:
Which results in following class being generated:
My issue occurs because not all
IssuableRapidTestDto
have aValidUntil
date set, when retrieving the data.If I remove
Required = Newtonsoft.Json.Required.DisallowNull
the deserialization works andValidUntil
holdsDateTimeOffet.MinValue
. As this is generated code I don't want to adapt it manually.I'm having a hard time figuring out if
ValidUntil
is actually required or not.The text was updated successfully, but these errors were encountered: