Manatee.Json
Manatee.Json copied to clipboard
additionalProperties of additionalProperties
Describe the bug
additionalProperties inside an additionalProperties subschema is not properly validated.
To Reproduce
using System;
using Manatee.Json;
using Manatee.Json.Schema;
using Manatee.Json.Serialization;
namespace test
{
class Program
{
static void Main(string[] args)
{
var schemaStr = @"
{
""$schema"": ""http://json-schema.org/draft-07/schema#"",
""additionalProperties"": {
""additionalProperties"": false
}
}";
var jsonStr = @"
{
""abc"": {
""abc"": ""abc""
}
}";
var serializer = new JsonSerializer();
var schema = serializer.Deserialize<JsonSchema>(JsonValue.Parse(schemaStr));
var json = JsonValue.Parse(jsonStr);
var validation = schema.Validate(json);
Console.WriteLine("{0}", serializer.Serialize(validation));
}
}
}
Should give false, gives true.
Version
- Manatee.Json 13.0.3
Additional context This problem doesn't exist in JsonSchema.NET.
What does that schema do? Instances can have properties so long as they're not an object or have no properties?
Also, I'm winding down support for this library in favor of the new one. Happy to pull in a PR if you want to try and fix it, though.
Yes, that what it means. It's of course contrived, but it is just a minimal reproduction from a larger schema I had. I think that also other subschemas inside additionalProperties aren't properly checked.
As mentioned above, this bug doesn't exist in the newer one, and I guess we'll switch soon. But I thought if I found it, I might as well document it.