1

Using this schema, this file does not catch the name_en and legalName_en fields under parties/identifier, even though additionalProperties: false is specified on the identifier property.

This is with:

 jsonschema schema.json -i file.json

on OSX, using python-jsonschema.

Am I doing something wrong, or is this a bug?

Richard
  • 62,943
  • 126
  • 334
  • 542

1 Answers1

1

I don't think it's a bug - at least if it is it's also a bug in the processor which http://www.jsonschemavalidator.net/ uses.

What is weird is that there are other instances where additionalProperties:false has been specified where the validator is honouring it. There are four properties in the packageInfo section which are being caught eg:

Property 'documentation_en' has not been defined and the schema does not allow additional properties. Schema path: http://standard.open-contracting.org/schema/1__1__0/release-schema.json#/properties/packageInfo/properties/publisher/additionalProperties

If I remove the excess properties from the packageInfo section then the entire payload validates fine.

I then removed the patternProperties property from the Identity definition and the validator started working. So something about the presence or value of patternProperties in a definition is preventing additionalProperties validation from working, is all I can surmise.

Furthermore, it's not just the existence of patternProperties which acts as the switch. I added a patternProperties property to the packageInfo definition to see if it stopped the validator from validating the 4 excess properties, but it still worked. So it must be something else. Very mysterious.

tom redfern
  • 30,562
  • 14
  • 91
  • 126
  • 1
    Thanks, that's super helpful. For my purposes I can just get rid of the `patternProperties` properties throughout. I wonder if it's the content of `patternProperties` which the validator doesn't like. – Richard Aug 08 '17 at 12:12