RicoSuter/NJsonSchema
minlength is impacted by required attribute in json schema
Ouverte
#768 ouverte le 31 août 2018
help wantedtype: enhancement
Métriques du dépôt
- Stars
- (1 581 étoiles)
- Métriques de merge PR
- (Merge moyen 39j 6h) (1 PR mergée en 30 j)
Description
I used below schema to generate C# code using CSharpGenerator. But there is no validation for the length if the field marked as required. The validation ( [System.ComponentModel.DataAnnotations.StringLength(int.MaxValue, MinimumLength = 1)]) is correctly generated if the field is not marked as required.
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "files": { "type": "string", "minlength": 1 } }, "required": [ "files" ] }
Is this intentional? I am using version: 9.10.67 on nuget.