Skip to content

Instantly share code, notes, and snippets.

@bradwilson
Created January 10, 2013 22:20
Show Gist options
  • Select an option

  • Save bradwilson/4506316 to your computer and use it in GitHub Desktop.

Select an option

Save bradwilson/4506316 to your computer and use it in GitHub Desktop.
[Fact]
public void Monkey()
{
string schema =
@"{
""id"": ""System.Version"",
""type"": ""object"",
""additionalProperties"": false,
""properties"": {
""Major"": {
""type"": ""integer""
},
""Minor"": {
""type"": ""integer""
},
""Build"": {
""type"": ""integer""
},
""Revision"": {
""type"": ""integer""
},
""MajorRevision"": {
""type"": ""integer""
},
""MinorRevision"": {
""type"": ""integer""
}
}
}";
JsonSchema jschema = JsonSchema.Parse(schema);
var jobj = JToken.Parse(@"{}");
IList<string> messages;
bool result = jobj.IsValid(jschema, out messages);
Assert.True(result); // messages is empty, result is true... counterintuitive?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment