From f9371470ba4e52d708b4280270e6d9d32b1b82bd Mon Sep 17 00:00:00 2001 From: Riccardo Manfrin Date: Fri, 23 Apr 2021 15:11:20 +0200 Subject: [PATCH] Compliance --- openapi3/schema.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openapi3/schema.go b/openapi3/schema.go index acf88f191..90e3985c4 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -846,9 +846,9 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val if discriminatorVal, okcheck := valuemap[pn]; okcheck { if len(schema.Discriminator.Mapping) > 0 { if mapref, okcheck := schema.Discriminator.Mapping[discriminatorVal.(string)]; okcheck { - for _, item := range v { - if item.Ref == mapref { - return item.Value.visitJSON(settings, value) + for _, oneof := range v { + if oneof.Ref == mapref { + return oneof.Value.visitJSON(settings, value) } } } @@ -857,9 +857,9 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val ``It is implied, that the property to which discriminator refers, contains the name of the target schema. In the example above, the objectType property should contain either simpleObject, or complexObject string.''*/ - for _, oneof := range schema.OneOf { - if strings.HasSuffix(oneof.Ref, discriminatorVal.(string)) { - return oneof.Value.visitJSON(settings, value) + for _, v := range schema.OneOf { + if strings.HasSuffix(v.Ref, discriminatorVal.(string)) { + return v.Value.visitJSON(settings, value) } } }