orderly icon indicating copy to clipboard operation
orderly copied to clipboard

incorrect jsonschema generated when additionalProperties is present

Open lloyd opened this issue 15 years ago • 0 comments

On Mon, Feb 22, 2010 at 02:58:24PM +0200, Petri Lehtinen wrote:

It seems to me that the "try it" editor on orderly-json.org works incorrectly regarding the additionalProperties attribute. It outputs

"additionalProperties": true / false

Here's a quote from the JSON schema specification, regarding the additionalProperties attribute:

The value must be a schema. If false is provided, no additional properties are allowed, and the schema can not be extended. The default value is an empty schema which allows any value for additional properties.

The spec doesn't tell what exactly is an empty schema, but "the schema for JSON schemas" (http://json-schema.org/schema) has {} as the default value for "additionalProperties", so I believe that the correct output should be

 "additionalProperties": {} / false

The "additionalProperties" could also be left out at all when the object definition is open (i.e. there's an asterisk at the end).

lloyd avatar Feb 22 '10 17:02 lloyd