Forum Discussion

ramjet69's avatar
ramjet69
New Contributor
5 years ago

nullable and default are not generating as expected in my model

Good Morning,

 

I'm having difficulty with nullable: false not generating correctly. From everything I can see it is correct. I am wondering if this is applicable to my scenario.

 

https://community.smartbear.com/t5/SwaggerHub/json-schema-validation-of-null-values/m-p/186450#M861

 

Here is the relevant snippet:

isWithdrawalPaused:
   type: boolean
   nullable: false

Which produces:

[DataMember(Name="isWithdrawalPaused")]
public bool? IsWithdrawalPaused { get; set; }

For those not familiar with c# the bool? is a nullable and I want bool.

 

I don't know where the breakdown is and so perhaps it is the engine we are using to interpret the swagger into C#?

swagger-codegen-cli-2.3.0.jar

Any suggestions would be greatly appreciated.

 

TIA