POST RAML schema, JSON format:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"uuid": {"$ref": "../_common/types/uuid.json"},
"url": {"$ref": "../_common/types/url.json"}
},
"type": "object",
"additionalProperties": false,
"properties": {
"domain": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["book", "car", "toy"]
},
"author": {
"type": "string"
},
"external_id": {
"type": "string"
},
},
"required": ["domain", "type"]
}
How can I express these conditions:
- The
author
will be ignored for types other than books. - The
external_id
will be generated for books (it should not be provided for books).
Thank you