RicoSuter / NJsonSchema

JSON Schema reader, generator and validator for .NET
http://NJsonSchema.org
MIT License
1.38k stars 532 forks source link

Validate wrong results? #1655

Open SyntaxTalksToMe opened 9 months ago

SyntaxTalksToMe commented 9 months ago

Good day,

If I want to validate a JSON using a schema, I get an incorrect result.

Case 1: I used the directed SPDX schema. (https://github.com/spdx/spdx-spec/blob/development/v2.3.1/schemas/spdx-schema.json) I then took an SPDX Json file and deliberately destroyed the structure by deleting elements. As a result, I received a 0 error count during validation. However, if I only insert minor errors and do not make major changes to the structure, the validation works.

Case 2: I had also tested a json that did not match the schema at all. There I also got 0 error counts.

Case 3: If I try the example from https://medium.com/@niteshsinghal85/validating-json-with-schema-in-net-7bdc02b0ef3c the Validation works as expected.

Basically, I would have expected that no matter which json I wanted to validate using a schema, this would also work and at least get some feedback that something is not taking. So I wanted to ask if this behavior is correct, or if I have misunderstood something or made a mistake in my thinking about how this validation works.

Thanks and good times