Opened 8 years ago

Last modified 2 years ago

#13162 new defect

JSON extended schema problem

Reported by: Douglas Hays Owned by: Kris Zyp
Priority: high Milestone: 1.15
Component: Dojox Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

From Iain Duncan
To recreate run the following JavaScript?:

	dojo.provide("dojox.json.tests.schema");
	dojo.require("dojox.json.schema");
	dojo.require("dojox.json.ref");
	var data = {
		"name" : "a string",
		"another": "someString"
	}
	var schema = {
		"type": "object",
		"properties": {
			"name": {"type": "string"}
		},
		"extends": {
			"type": "object",
			"additionalProperties": false,
			"properties": {
				"another": {"type": "string"}
			}
		}
	}
	schema = dojox.json.ref.resolveJson(schema);
	var result = dojox.json.schema.validate(data, schema);

You will then get the error message:

"The property name is not defined in the schema and the schema does not allow additional properties"

This is because the extended schema does not allow additional properties. When extending it instead of inheriting all of the properties the validate validates each schema separately rather than as one combined schema.

This issue was discussed on the JSON Schema group here:

https://groups.google.com/forum/#!topic/json-schema/J1zfffdURIs

Change History (2)

comment:1 Changed 3 years ago by dylan

Milestone: tbd1.12

Consider for 1.12.

comment:2 Changed 2 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.