github.com/alecthomas/jsonschema@v0.0.0-20220216202328-9eeeec9d044b/fixtures/oneof.json (about) 1 { 2 "$schema": "http://json-schema.org/draft-04/schema#", 3 "$ref": "#/definitions/RootOneOf", 4 "definitions": { 5 "ChildOneOf": { 6 "properties": { 7 "child1": { 8 "type": "string" 9 }, 10 "child2": { 11 "type": "string" 12 }, 13 "child3": { 14 "additionalProperties": true, 15 "oneOf": [ 16 { 17 "type": "string" 18 }, 19 { 20 "type": "array" 21 } 22 ] 23 }, 24 "child4": { 25 "type": "string" 26 } 27 }, 28 "additionalProperties": false, 29 "type": "object", 30 "oneOf": [ 31 { 32 "required": [ 33 "child1", 34 "child4" 35 ], 36 "title": "group1" 37 }, 38 { 39 "required": [ 40 "child2", 41 "child3" 42 ], 43 "title": "group2" 44 } 45 ] 46 }, 47 "RootOneOf": { 48 "properties": { 49 "field1": { 50 "type": "string" 51 }, 52 "field2": { 53 "type": "string" 54 }, 55 "field3": { 56 "additionalProperties": true, 57 "oneOf": [ 58 { 59 "type": "string" 60 }, 61 { 62 "type": "array" 63 } 64 ] 65 }, 66 "field4": { 67 "type": "string" 68 }, 69 "child": { 70 "$schema": "http://json-schema.org/draft-04/schema#", 71 "$ref": "#/definitions/ChildOneOf" 72 } 73 }, 74 "additionalProperties": false, 75 "type": "object", 76 "oneOf": [ 77 { 78 "required": [ 79 "field1", 80 "field4" 81 ], 82 "title": "group1" 83 }, 84 { 85 "required": [ 86 "field2" 87 ], 88 "title": "group2" 89 } 90 ] 91 } 92 } 93 }