-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Open
Labels
Description
Is your feature request related to a problem? Please describe.
With the current csharp generators (except generichost), there is a confusion between required and nullable fields. Nullable fields and non-required fields are both using the csharp nullable operator "?". It leads to several problems.
- When a field is defined as not required and nullable, it's impossible to know if its value is missing or null.
- Model validation is sometimes incorrect ([BUG] [CSHARP] Models from schema with a property attribute "nullable": true are generating properties not nullable #21090)
Describe the solution you'd like
Make a distinction between required and nullable fields. The solution used by generichost, using an Option struct for required fields seems good.
Describe alternatives you've considered
An alternative is moving to generichost but it's not possible for my project.
johnthagen