diff --git a/openapi3/schema_test.go b/openapi3/schema_test.go index 81898c888..3a47e75ac 100644 --- a/openapi3/schema_test.go +++ b/openapi3/schema_test.go @@ -161,6 +161,43 @@ var schemaExamples = []schemaExample{ }, }, + { + Title: "NULLABLE ALLOF", + Schema: &Schema{ + Type: "object", + Properties: map[string]*SchemaRef{ + "value": NewAllOfSchema( + NewBoolSchema().WithNullable(), + NewBoolSchema().WithNullable(), + ).NewRef()}}, + Serialization: map[string]interface{}{ + "type": "object", + "properties": map[string]interface{}{ + "value": map[string]interface{}{ + "allOf": []interface{}{ + map[string]interface{}{ + "nullable": true, + "type": "boolean", + }, + map[string]interface{}{ + "nullable": true, + "type": "boolean", + }, + }}}}, + AllValid: []interface{}{ + nil, + true, + false, + }, + AllInvalid: []interface{}{ + 2, + 4.2, + []interface{}{42}, + "bla", + map[string]interface{}{}, + }, + }, + { Title: "BOOLEAN", Schema: NewBoolSchema(),