I noticed while generating an API client using the typescript-fetch
generator that the generated interfaces designate all properties as nullable, even when not designated as nullable in the swagger/open API definition. Furthermore, the only time they were made non-nullable is when the property was annotated with required = true
.
I haven't found a clear distinction between "required" and "nullable" as it relates to how it should affect codegen, but intuitively, "required" seems like it should have clients enforce that a value be present when creating a request, while having nullable = false
(which is the default) should generate a property on the response object that isn't nullable.
I'm looking for a clear distinction between the two, in order to identify if there is an issue with code-gen with respect to designating fields nullable or not.