If I have a property:
public int? Test { get; set; }
The correspoding swagger defination is:
test integer($int32)
nullable: true
However, when I add [Required]
attribute to it:
[Required]
public int? Test { get; set; }
My swagger defination is:
test* integer($int32)
Why is it no longer nullable?
The
[Reqiured]
attribute you are using forces the value, to not benull
.According to the documentation: