{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "MyStruct", "type": "object", "properties": { "my_int": { "type": "integer", "format": "int32" }, "my_bool": { "type": "boolean" }, "my_nullable_enum": { "anyOf": [ { "$ref": "#/$defs/MyEnum" }, { "type": "null" } ] } }, "required": [ "my_int", "my_bool" ], "$defs": { "MyEnum": { "oneOf": [ { "type": "object", "properties": { "StringNewType": { "type": "string" } }, "required": [ "StringNewType" ], "additionalProperties": false }, { "type": "object", "properties": { "StructVariant": { "type": "object", "properties": { "floats": { "type": "array", "items": { "type": "number", "format": "float" } } }, "required": [ "floats" ] } }, "required": [ "StructVariant" ], "additionalProperties": false } ] } } }