Description
I have an object with two properties, one of them is type array and can contain multiple definitions inside, my schema definition is this:
{ "id": "public/doc/json_schema", "type": "object", "required": [ "code", "data" ], "additionalProperties": false, "properties": { "code": { "type": "number", "example": 200 }, "data": { "type": "object", "required": [ "message", "feed" ], "additionalProperties": false, "properties": { "message": { "type": "string", "example": "User feed information" }, "feed": { "type": "array", "items": { "anyOf": [ { "$ref": "./event/event_sport_activity_rewarded.json" }, { "$ref": "./event/event_voucher_acquired.json" }, { "$ref": "./event/event_challenge_accepted.json" }, { "$ref": "./event/event_challenge_completed.json" }, { "$ref": "./event/event_challenge_abandoned.json" }, { "$ref": "./event/event_challenge_expired.json" } ] } } } } } }
All the schemas inside anyOf starts like this:
{ "type": "object",
Am I missing something? when I try to validate an array with some events that match any of theses, random errors are fired indicating that some field is missing (a field from another schema).