corvus-dotnet / Corvus.JsonSchema

Support for Json Schema validation and entity generation
Apache License 2.0
112 stars 8 forks source link

Generate multiple identifier declarations with the same name (PatternPropertyJsonString) #489

Open moomiji opened 3 hours ago

moomiji commented 3 hours ago

Error CS0102

moomiji commented 2 hours ago

The .Validate(ValidationContext.ValidContext, ValidationLevel.Verbose) method also does not work, when only the doc property is kept.

var test = """ { "a_doc": "aaa", "b_doc": "bbb" } """;

var document = Test.SchemaEntity.Parse(test); var result = document.Validate(ValidationContext.ValidContext, ValidationLevel.Verbose);


- error

Unhandled exception. System.InvalidOperationException: This operation does not apply to an empty instance. at System.Collections.Immutable.ImmutableStack`1.Pop() at Corvus.Json.ValidationContext.PopLocation() at JsonSchemaSample.Test.Test.SchemaEntity.Validate(ValidationContext& validationContext, ValidationLevel level) in C:\Users\73734\source\JsonSchemaSample\test\Test.SchemaEntity.Validate.cs:line 62 at Program.

$(String[] args) in C:\Users\73734\source\JsonSchemaSample\Program.cs:line 300