diff --git a/go.mod b/go.mod index 05b6c2087..077c8acdd 100644 --- a/go.mod +++ b/go.mod @@ -22,8 +22,6 @@ require ( sigs.k8s.io/yaml v1.4.0 ) -//replace github.com/hashicorp/terraform-plugin-docs => ../../../../github.com/sebhoss/terraform-plugin-docs - require ( cloud.google.com/go v0.112.0 // indirect cloud.google.com/go/compute v1.23.3 // indirect diff --git a/tools/internal/generator/openapiv3_converter.go b/tools/internal/generator/openapiv3_converter.go index 460b07df6..cd8052a1b 100644 --- a/tools/internal/generator/openapiv3_converter.go +++ b/tools/internal/generator/openapiv3_converter.go @@ -106,9 +106,9 @@ func openAPIv3Properties(schema *openapi3.Schema, imports *AdditionalImports, pa } var nestedProperties []*Property - if prop.Value.Type == "array" && prop.Value.Items != nil && prop.Value.Items.Value != nil && prop.Value.Items.Value.Type == "object" { + if prop.Value.Type.Is(openapi3.TypeArray) && prop.Value.Items != nil && prop.Value.Items.Value != nil && prop.Value.Items.Value.Type.Is(openapi3.TypeObject) { nestedProperties = openAPIv3Properties(prop.Value.Items.Value, imports, propPath, terraformResourceName) - } else if prop.Value.Type == "object" && prop.Value.AdditionalProperties.Schema != nil && prop.Value.AdditionalProperties.Schema.Value.Type == "object" { + } else if prop.Value.Type.Is(openapi3.TypeObject) && prop.Value.AdditionalProperties.Schema != nil && prop.Value.AdditionalProperties.Schema.Value.Type.Is(openapi3.TypeObject) { nestedProperties = openAPIv3Properties(prop.Value.AdditionalProperties.Schema.Value, imports, propPath, terraformResourceName) } else { nestedProperties = openAPIv3Properties(prop.Value, imports, propPath, terraformResourceName) diff --git a/tools/internal/generator/openapiv3_type_translator.go b/tools/internal/generator/openapiv3_type_translator.go index c3af2dff8..745a5ddfc 100644 --- a/tools/internal/generator/openapiv3_type_translator.go +++ b/tools/internal/generator/openapiv3_type_translator.go @@ -16,28 +16,28 @@ type openapiv3TypeTranslator struct { } func (t *openapiv3TypeTranslator) hasNoType() bool { - return t.property.Type == "" + return t.property.Type == nil || len(t.property.Type.Slice()) == 0 } func (t *openapiv3TypeTranslator) isIntOrString() bool { _, ok := t.property.Extensions["x-kubernetes-int-or-string"] - return ok || t.property.Type == "string" && t.property.Format == "int-or-string" + return ok || t.property.Type.Is(openapi3.TypeString) && t.property.Format == "int-or-string" } func (t *openapiv3TypeTranslator) isBoolean() bool { - return t.property.Type == "boolean" + return t.property.Type.Is(openapi3.TypeBoolean) } func (t *openapiv3TypeTranslator) isString() bool { - return t.property.Type == "string" + return t.property.Type.Is(openapi3.TypeString) } func (t *openapiv3TypeTranslator) isInteger() bool { - return t.property.Type == "integer" + return t.property.Type.Is(openapi3.TypeInteger) } func (t *openapiv3TypeTranslator) isNumber() bool { - return t.property.Type == "number" + return t.property.Type.Is(openapi3.TypeNumber) } func (t *openapiv3TypeTranslator) isFloat() bool { @@ -45,11 +45,11 @@ func (t *openapiv3TypeTranslator) isFloat() bool { } func (t *openapiv3TypeTranslator) isArray() bool { - return t.property.Type == "array" + return t.property.Type.Is(openapi3.TypeArray) } func (t *openapiv3TypeTranslator) isObject() bool { - return t.property.Type == "object" + return t.property.Type.Is(openapi3.TypeObject) } func (t *openapiv3TypeTranslator) hasUnknownFields() bool { @@ -67,7 +67,7 @@ func (t *openapiv3TypeTranslator) hasOneOf() bool { func (t *openapiv3TypeTranslator) isOneOfArray() bool { for _, oneOf := range t.property.OneOf { - if oneOf.Value.Type == "array" { + if oneOf.Value.Type.Is(openapi3.TypeArray) { return true } } @@ -76,7 +76,7 @@ func (t *openapiv3TypeTranslator) isOneOfArray() bool { func (t *openapiv3TypeTranslator) isOneOfBoolean() bool { for _, oneOf := range t.property.OneOf { - if oneOf.Value.Type == "boolean" { + if oneOf.Value.Type.Is(openapi3.TypeBoolean) { return true } } @@ -84,33 +84,33 @@ func (t *openapiv3TypeTranslator) isOneOfBoolean() bool { } func (t *openapiv3TypeTranslator) isObjectWithAdditionalStringProperties() bool { - return t.property.Type == "object" && + return t.property.Type.Is(openapi3.TypeObject) && t.property.AdditionalProperties.Schema != nil && - t.property.AdditionalProperties.Schema.Value.Type == "string" + t.property.AdditionalProperties.Schema.Value.Type.Is(openapi3.TypeString) } func (t *openapiv3TypeTranslator) isObjectWithAdditionalObjectProperties() bool { - return t.property.Type == "object" && + return t.property.Type.Is(openapi3.TypeObject) && t.property.AdditionalProperties.Schema != nil && - t.property.AdditionalProperties.Schema.Value.Type == "object" + t.property.AdditionalProperties.Schema.Value.Type.Is(openapi3.TypeObject) } func (t *openapiv3TypeTranslator) isObjectWithAdditionalArrayProperties() bool { - return t.property.Type == "object" && + return t.property.Type.Is(openapi3.TypeObject) && t.property.AdditionalProperties.Schema != nil && - t.property.AdditionalProperties.Schema.Value.Type == "array" + t.property.AdditionalProperties.Schema.Value.Type.Is(openapi3.TypeArray) } func (t *openapiv3TypeTranslator) isArrayWithObjectItems() bool { - return t.property.Type == "array" && + return t.property.Type.Is(openapi3.TypeArray) && t.property.Items != nil && t.property.Items.Value != nil && - t.property.Items.Value.Type == "object" + t.property.Items.Value.Type.Is(openapi3.TypeObject) } func (t *openapiv3TypeTranslator) additionalPropertiesHaveStringItems() bool { return t.property.AdditionalProperties.Schema.Value.Items != nil && - t.property.AdditionalProperties.Schema.Value.Items.Value.Type == "string" + t.property.AdditionalProperties.Schema.Value.Items.Value.Type.Is(openapi3.TypeString) } func (t *openapiv3TypeTranslator) additionalPropertiesHaveProperties() bool { @@ -124,17 +124,17 @@ func (t *openapiv3TypeTranslator) additionalPropertiesHaveUnknownFields() bool { func (t *openapiv3TypeTranslator) additionalPropertiesHaveAdditionalStringProperties() bool { return t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema != nil && - t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema.Value.Type == "string" + t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema.Value.Type.Is(openapi3.TypeString) } func (t *openapiv3TypeTranslator) additionalPropertiesHaveAdditionalArrayProperties() bool { return t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema != nil && - t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema.Value.Type == "array" + t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema.Value.Type.Is(openapi3.TypeArray) } func (t *openapiv3TypeTranslator) additionalPropertiesHaveAdditionalPropertiesWithStringItems() bool { return t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema.Value.Items != nil && - t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema.Value.Items.Value.Type == "string" + t.property.AdditionalProperties.Schema.Value.AdditionalProperties.Schema.Value.Items.Value.Type.Is(openapi3.TypeString) } func (t *openapiv3TypeTranslator) itemsHaveUnknownFields() bool { @@ -144,5 +144,5 @@ func (t *openapiv3TypeTranslator) itemsHaveUnknownFields() bool { func (t *openapiv3TypeTranslator) itemsHaveAdditionalStringProperties() bool { return t.property.Items.Value.AdditionalProperties.Schema != nil && - t.property.Items.Value.AdditionalProperties.Schema.Value.Type == "string" + t.property.Items.Value.AdditionalProperties.Schema.Value.Type.Is(openapi3.TypeString) } diff --git a/tools/internal/generator/openapiv3_validator_extractor.go b/tools/internal/generator/openapiv3_validator_extractor.go index 53919c944..e3ae36996 100644 --- a/tools/internal/generator/openapiv3_validator_extractor.go +++ b/tools/internal/generator/openapiv3_validator_extractor.go @@ -18,7 +18,7 @@ type openapiv3ValidatorExtractor struct { } func (v *openapiv3ValidatorExtractor) integerWithMinimum() string { - if v.property.Type == "integer" && v.property.Min != nil { + if v.property.Type.Is(openapi3.TypeInteger) && v.property.Min != nil { v.imports.Int64Validator = true min := *v.property.Min if v.property.ExclusiveMin { @@ -30,7 +30,7 @@ func (v *openapiv3ValidatorExtractor) integerWithMinimum() string { } func (v *openapiv3ValidatorExtractor) integerWithMaximum() string { - if v.property.Type == "integer" && v.property.Max != nil { + if v.property.Type.Is(openapi3.TypeInteger) && v.property.Max != nil { v.imports.Int64Validator = true max := *v.property.Max if v.property.ExclusiveMax { @@ -42,7 +42,7 @@ func (v *openapiv3ValidatorExtractor) integerWithMaximum() string { } func (v *openapiv3ValidatorExtractor) integerWithEnums() string { - if v.property.Type == "integer" && len(v.property.Enum) > 0 { + if v.property.Type.Is(openapi3.TypeInteger) && len(v.property.Enum) > 0 { v.imports.Int64Validator = true enums := openapiIntEnums(v.property.Enum) return fmt.Sprintf("int64validator.OneOf(%v)", concatEnums(enums)) @@ -51,7 +51,7 @@ func (v *openapiv3ValidatorExtractor) integerWithEnums() string { } func (v *openapiv3ValidatorExtractor) numberWithMinimum() string { - if v.property.Type == "number" && v.property.Min != nil { + if v.property.Type.Is(openapi3.TypeNumber) && v.property.Min != nil { v.imports.Float64Validator = true min := *v.property.Min if v.property.ExclusiveMin { @@ -63,7 +63,7 @@ func (v *openapiv3ValidatorExtractor) numberWithMinimum() string { } func (v *openapiv3ValidatorExtractor) numberWithMaximum() string { - if v.property.Type == "number" && v.property.Max != nil { + if v.property.Type.Is(openapi3.TypeNumber) && v.property.Max != nil { v.imports.Float64Validator = true max := *v.property.Max if v.property.ExclusiveMax { @@ -75,7 +75,7 @@ func (v *openapiv3ValidatorExtractor) numberWithMaximum() string { } func (v *openapiv3ValidatorExtractor) numberWithEnums() string { - if v.property.Type == "number" && len(v.property.Enum) > 0 { + if v.property.Type.Is(openapi3.TypeNumber) && len(v.property.Enum) > 0 { v.imports.Float64Validator = true enums := openapiFloatEnums(v.property.Enum) return fmt.Sprintf("float64validator.OneOf(%v)", concatEnums(enums)) @@ -84,21 +84,21 @@ func (v *openapiv3ValidatorExtractor) numberWithEnums() string { } func (v *openapiv3ValidatorExtractor) stringWithByteFormat() string { - if v.property.Type == "string" && v.property.Format == "byte" { + if v.property.Type.Is(openapi3.TypeString) && v.property.Format == "byte" { return "validators.Base64Validator()" } return "" } func (v *openapiv3ValidatorExtractor) stringWithDateTimeFormat() string { - if v.property.Type == "string" && v.property.Format == "date-time" { + if v.property.Type.Is(openapi3.TypeString) && v.property.Format == "date-time" { return "validators.DateTime64Validator()" } return "" } func (v *openapiv3ValidatorExtractor) stringWithMinimumLength() string { - if v.property.Type == "string" && v.property.MinLength != 0 { + if v.property.Type.Is(openapi3.TypeString) && v.property.MinLength != 0 { v.imports.StringValidator = true return fmt.Sprintf("stringvalidator.LengthAtLeast(%v)", v.property.MinLength) } @@ -106,7 +106,7 @@ func (v *openapiv3ValidatorExtractor) stringWithMinimumLength() string { } func (v *openapiv3ValidatorExtractor) stringWithMaximumLength() string { - if v.property.Type == "string" && v.property.MaxLength != nil { + if v.property.Type.Is(openapi3.TypeString) && v.property.MaxLength != nil { v.imports.StringValidator = true return fmt.Sprintf("stringvalidator.LengthAtMost(%v)", *v.property.MaxLength) } @@ -114,7 +114,7 @@ func (v *openapiv3ValidatorExtractor) stringWithMaximumLength() string { } func (v *openapiv3ValidatorExtractor) stringWithEnums() string { - if v.property.Type == "string" && len(v.property.Enum) > 0 { + if v.property.Type.Is(openapi3.TypeString) && len(v.property.Enum) > 0 { v.imports.StringValidator = true enums := openapiStringEnums(v.property.Enum) return fmt.Sprintf("stringvalidator.OneOf(%s)", concatEnums(enums)) @@ -123,7 +123,7 @@ func (v *openapiv3ValidatorExtractor) stringWithEnums() string { } func (v *openapiv3ValidatorExtractor) stringWithPattern() string { - if v.property.Type == "string" && v.property.Pattern != "" { + if v.property.Type.Is(openapi3.TypeString) && v.property.Pattern != "" { v.imports.Regexp = true v.imports.StringValidator = true return fmt.Sprintf(`stringvalidator.RegexMatches(regexp.MustCompile(%s), "")`, escapeRegexPattern(v.property.Pattern)) diff --git a/tools/internal/generator/type_translator_test.go b/tools/internal/generator/type_translator_test.go index a6f4e2c89..3c559d5b8 100644 --- a/tools/internal/generator/type_translator_test.go +++ b/tools/internal/generator/type_translator_test.go @@ -468,7 +468,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/string": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "string", + Type: &openapi3.Types{"string"}, }, }, attributeType: "schema.StringAttribute", @@ -479,7 +479,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/boolean": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "boolean", + Type: &openapi3.Types{"boolean"}, }, }, attributeType: "schema.BoolAttribute", @@ -490,7 +490,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/integer": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "integer", + Type: &openapi3.Types{"integer"}, }, }, attributeType: "schema.Int64Attribute", @@ -501,7 +501,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/number": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "number", + Type: &openapi3.Types{"number"}, }, }, attributeType: "schema.Float64Attribute", @@ -512,7 +512,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/float-float": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "number", + Type: &openapi3.Types{"number"}, Format: "float", }, }, @@ -524,7 +524,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/float-double": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "number", + Type: &openapi3.Types{"number"}, Format: "double", }, }, @@ -536,7 +536,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/array": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, }, }, attributeType: "schema.ListAttribute", @@ -547,7 +547,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, }, }, attributeType: "schema.MapAttribute", @@ -558,7 +558,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-properties": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, Properties: openapi3.Schemas{ "first": {}, }, @@ -572,10 +572,10 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/array-of-objects": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, Items: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, }, }, }, @@ -588,10 +588,10 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/array-of-objects-with-unknown-fields": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, Items: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, Extensions: map[string]interface{}{ "x-kubernetes-preserve-unknown-fields": "true", }, @@ -607,14 +607,14 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/array-of-objects-with-additional-string-properties": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, Items: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "string", + Type: &openapi3.Types{"string"}, }, }, }, @@ -630,11 +630,11 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-array-properties": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, }, }, }, @@ -648,14 +648,14 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-array-properties-having-string-items": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, Items: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "string", + Type: &openapi3.Types{"string"}, }, }, }, @@ -671,11 +671,11 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-object-properties": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, }, }, }, @@ -689,15 +689,15 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-object-properties-having-additional-string-properties": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "string", + Type: &openapi3.Types{"string"}, }, }, }, @@ -714,15 +714,15 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-object-properties-having-additional-array-properties": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, }, }, }, @@ -739,11 +739,11 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-object-properties-having-unknown-fields": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, Extensions: map[string]interface{}{ "x-kubernetes-preserve-unknown-fields": "true", }, @@ -760,11 +760,11 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-object-properties-having-properties": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, Extensions: map[string]interface{}{ "x-kubernetes-preserve-unknown-fields": "true", }, @@ -784,18 +784,18 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-object-properties-having-additional-array-properties-with-string-items": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, Items: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "string", + Type: &openapi3.Types{"string"}, }, }, }, @@ -814,11 +814,11 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/object-with-additional-string-properties": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "object", + Type: &openapi3.Types{"object"}, AdditionalProperties: openapi3.AdditionalProperties{ Schema: &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "string", + Type: &openapi3.Types{"string"}, }, }, }, @@ -835,7 +835,7 @@ func TestTranslateTypeWith(t *testing.T) { OneOf: openapi3.SchemaRefs{ &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "array", + Type: &openapi3.Types{"array"}, }, }, }, @@ -852,7 +852,7 @@ func TestTranslateTypeWith(t *testing.T) { OneOf: openapi3.SchemaRefs{ &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "boolean", + Type: &openapi3.Types{"boolean"}, }, }, }, @@ -869,7 +869,7 @@ func TestTranslateTypeWith(t *testing.T) { OneOf: openapi3.SchemaRefs{ &openapi3.SchemaRef{ Value: &openapi3.Schema{ - Type: "string", + Type: &openapi3.Types{"string"}, }, }, }, @@ -925,7 +925,7 @@ func TestTranslateTypeWith(t *testing.T) { "OpenAPIv3/string-or-int": { translator: &openapiv3TypeTranslator{ property: &openapi3.Schema{ - Type: "string", + Type: &openapi3.Types{"string"}, Format: "int-or-string", }, },