-
Notifications
You must be signed in to change notification settings - Fork 673
Closed
Labels
Description
This is more related to an issue with the Swagger spec itself (OAI/OpenAPI-Specification#229) but I thought it would be important to track here too. Right now there's no difference between a required field and a nullable field. Let's say I have a model that looks like this
class Product
{
[Required]
public int ProductId {get;set;}
[Required]
public string ProductName {get;set;}
public string Description {get;set;}
[Required]
public int? SomeSuperValidReasonThisFieldShouldBeNullableAndRequiredBesidesBadDesignThatImMarriedTo {get;set;}
}
The best way to do this would be have the nullable field be "type" : ["number","null"]
but alas swagger doesn't support that.
Right now I'm adding in custom mapping in the swaggerconfig for each of the main nullables and praying no one else does anything weird in the project to require other value types to be exposed as a nullable and putting a vendor extension of "x-nullable"