SwaggerProvider
SwaggerProvider copied to clipboard
Generator ignores nullability
Description
Service:
type: object
properties:
Услуга:
type: string
Стоимость:
type: number
format: ₴
nullable: false
Обязательная:
type: boolean
nullable: false
Expected behavior
Properties of value type marked as nullable: false
declared as non-nullable and has a non-nullable parameter in a constructor
Actual behavior
nullable: false
is ignored
Related information
1.0.0-Beta1
@sergey-tihon, please, point me where to apply fix I will code that today
Sorry, I do not understand what is the issue...
Here is the property generation code for OpenApiProvider and here for SwaggerProvider.
nullable: false
Here is the line where we determine if the property is optional. https://github.com/fsprojects/SwaggerProvider/blob/net5/src/SwaggerProvider.DesignTime/v3/DefinitionCompiler.fs#L202
Is easiest way to debug is to put breakpoint on this line and check how Microsoft.OpenApi.Readers
passed your schema.
Could that be because the fields aren't marked as required
in the schema, so the generated properties have to be optional to handle them not being present in the Json data?