JSON schema - how to use oneOf
问题 The following is a valid JSON schema according to http://jsonlint.com/ and http://jsonschemalint.com/draft4/#. { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": ["results"], "additionalProperties": false, "properties": { "results": { "type": "string", "oneOf": [ { "result": "1" }, { "result": "2" }, { "result": "3" }, { "result": "4" } ] } } } The following JSON reports an error ( results is the wrong type ) when validated against the above schema: {