JsonSchema of JsonSchemas at "http://json-schema.org/schema#" is not a JsonSChema

35 views
Skip to first unread message

hud...@googlemail.com

unread,
Mar 10, 2017, 4:20:40 AM3/10/17
to JSON Schema
Hello,

The topic sounds quite a bit confusing, doesn't it?

As far as I understand "JsonSchema-Validation" there is a standard JsonSchema under "http://json-schema.org/schema#" that should define the allowed structure for other JsonSchemas.
This standard JsonSchema at "http://json-schema.org/schema#" is a JsonFile itself (as any other JsonSchema would be) and is also a JsonSchema.

Now to the point of my own confusion:
When I validate this specific standard JsonSchema against itself, I get errors around the JsonNodes/JsonObject-PropertyKeys "additionalProperties".

As described at "http://json-schema.org/example2.html" the PropertyKeys "additionalProperties" should be at the same level as the PropertyKeys "properties".
But in the standard JsonSchema they are not. They are inside the JsonObject contained in Propertykey "properties".

What do I get wrong?

Second issue:
What does the reference entry
"$ref": "#"
mean?
What definition entry does it refer to?
The normal reference entry should look more like:
"$ref": "#/definitions/positiveInteger"

Any help is appreciated.

with kind regards
HuDeanY

Henry Andrews

unread,
Mar 10, 2017, 12:46:52 PM3/10/17
to json-...@googlegroups.com
Hello,
  The "additionalProperties" that you see under "properties" is defining the JSON Schema keyword *named* "additionalProperties".  So that's not the keyword itself being used, it's the definition of the keyword.  The "$ref": "#" means that "additionalProperties" (and other keywords) take a schema as their value.  The "#" is a URI reference consisting only of the empty fragment, which points to the root of the current JSON document- a recursive reference.  The empty string is technically an empty JSON Pointer.

  What validator are you using?  There are some validators that incorrectly treat keys under "properties" as JSON Schema keywords.  They are not, they are property names and are never treated as keywords even if they have the same names.

thanks,
-henry



From: hudeany via JSON Schema <json-...@googlegroups.com>
To: JSON Schema <json-...@googlegroups.com>
Sent: Wednesday, March 1, 2017 1:47 PM
Subject: [json-schema] JsonSchema of JsonSchemas at "http://json-schema.org/schema#" is not a JsonSChema

--
You received this message because you are subscribed to the Google Groups "JSON Schema" group.
To unsubscribe from this group and stop receiving emails from it, send an email to json-schema...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages