Skip to content

draft7 schema incorrect in the definition of the "not" property? #858

Closed
@karenetheridge

Description

@karenetheridge

I suspect there is a bug in the definition of the 'not' property in https://json-schema.org/draft-07/schema# -- its definition is { "$ref": "#" }, i.e. the root document itself, but the document root also has "default": true defined. "not": true is false, so we get false! :o

Here's a simple example. I start with a schema {"type":"object"}, and seek to validate it against the draft7 spec while filling in missing values with their defaults. The resulting schema becomes:

{
   "additionalItems" : true,
   "additionalProperties" : true,
   "contains" : true,
   "definitions" : {},
   "else" : true,
   "if" : true,
   "items" : true,
   "not" : true,
   "patternProperties" : {},
   "properties" : {},
   "propertyNames" : true,
   "readOnly" : false,
   "required" : [],
   "then" : true,
   "type" : "object",
   "uniqueItems" : false
}

..And now, any data evaluated against this schema will fail, because of the "not": true section.

It is valid to evaluate defaults in the draft7 schema itself, isn't it? or am I missing something fundamental about how defaults should work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions