Open douglasramiro opened 5 years ago
I have a similar issue where when using "$ref", all other properties seem discarded.
I would expect a kind of merge such as this:
{
"id": "/Common/id",
"type": "string"
// ... other properties
}
{
"id": "/OtherSchema/WhereINeedARequiredId",
"$ref": "/Common/id",
"required": true // I would expect the API to merge this object with the "ID",
"additionalProperties": false
}
{
"id": "/ASchema/WhereOptionalIdIsNeeded",
"$ref": "/Common/id"
}
Any thoughts on this ?
This is a change in behavior in some of the recent updates of JSON Schema. It used to be the case that objects with $ref
were not considered JSON Schemas, but were actually a feature defined in a different specification. This is no longer the case, and this should get fixed.
Hi,
Given the following scenario:
var addressSchema = { "id": "/SimpleAddress", "type": "object", "properties": { "city": {"type": "string"}, "country": {"type": "string", "required": true} }, };
and
var schema = { "id": "/SimplePerson", "type": "object", "properties": { "name": { "type": "string", "required": true }, "address": { "$ref": "/SimpleAddress", "required": true } } };
v.validate({}, "/SimplePerson");
Validating an empty person, the property name is returned as required. However, the address property is not.
One detail, if you pass an empty address, the address required properties are returned.
Is this an expected behavior?
Regards