From 1b40d2988356320e9ebe4c916e20aec48401dcdc Mon Sep 17 00:00:00 2001 From: Riccardo Manfrin Date: Tue, 13 Apr 2021 12:21:28 +0200 Subject: [PATCH] Cleaner [I'll squash this later] --- openapi3/schema.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openapi3/schema.go b/openapi3/schema.go index ac999ba6b..acf88f191 100644 --- a/openapi3/schema.go +++ b/openapi3/schema.go @@ -858,9 +858,7 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val name of the target schema. In the example above, the objectType property should contain either simpleObject, or complexObject string.''*/ for _, oneof := range schema.OneOf { - /* TODO: ugly.. should this be a property of the SchemaRef? */ - objectType := strings.ReplaceAll(oneof.Ref, "#/components/schemas/", "") - if objectType == discriminatorVal { + if strings.HasSuffix(oneof.Ref, discriminatorVal.(string)) { return oneof.Value.visitJSON(settings, value) } }