RicoSuter/NJsonSchema
minlength is impacted by required attribute in json schema
开放
#768 创建于 2018年8月31日
help wantedtype: enhancement
仓库指标
- 星标
- (1,581 个星标)
- PR 合并指标
- (平均合并 39天 6小时) (30 天内合并 1 个 PR)
描述
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.