2

I can't validate a json string starting from a very simple schema. This is my object type:

public class Person
{
    public string Name { get; set; }
}

public class MyPerson : Person
{
    public string Surname { get; set; }
}

And this is my test:

JsonSchema schema = JsonSchema.FromType(typeof(MyPerson));
var errors = schema.Validate(@"{'Surname':'Pippo','Name':'Pluto'}");

I always get the error:

{
    NotAllOf:#/
          {NoAdditionalPropertiesAllowed: #/Surname}
          {NoAdditionalPropertiesAllowed: #/Name}
}

Can someone help me? How should the json string be composed? Thanks in advance

Daniele Mereu
  • 115
  • 1
  • 8

1 Answers1

0

As minimum, strings must be in double quotes.

nozd
  • 11
  • 3