We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We have a c# type like this -
public class MyRequest { [JsonRequired] [JsonProperty("name")] public string Name { get; set; } }
But when i use the JSON like this -
{ "name": "abc", "name":"xyz" }
This is the test i am using -
[Test] public async System.Threading.Tasks.Task SchemaValidation_WithDuplicateProperty_Async() { var jsonString = await File.ReadAllTextAsync("Data//JsonWithDuplicateProperty.json"); var schema = JsonSchema.FromType<<MyRequest>>(); var errors = schema.Validate(jsonString); Assert.That(errors.Count(), Is.EqualTo(1)); }
How can i get NJsonSchema to throw "duplicate Property" or "too many properties" error ?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We have a c# type like this -
But when i use the JSON like this -
This is the test i am using -
How can i get NJsonSchema to throw "duplicate Property" or "too many properties" error ?
The text was updated successfully, but these errors were encountered: