From 6c31b3f0dd0ab0904158055ca5d2fd1a47c3fc90 Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Tue, 4 Feb 2020 19:07:19 +0100 Subject: [PATCH] reproduce issue Signed-off-by: Pierre Fenoll --- openapi3/schema_test.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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(),