Swaggeratr
Swaggeratr copied to clipboard
Selectively show nullable DataMembers as optional
By default Swaggeratr show nullable DataMembers as optional. This is kind of strange particularly in a read response contract.
What would a mandatory nullable parameter look like? Not that I'm opposed to an option to override that default, I'm just having trouble picturing the use case.
I was just thinking it would be nice to be able to remove the "optional" text in data type description of a parameter within a contract. But I guess "optional" text can just imply that it is possible that the parameter can be null for read responses.
Yeah, I think given we're talking about JSON/XML datacontracts, "optional" should be read as "nullable" most of the time. Especially given part of the value with Swagger is the ability to generate code from those contracts. Imagine generating code according to a Swagger spec, expecting that a given value in a response is required and will always be present - if it's actually nullable, eventually a JSON response may leave it out, and that code might fail.