Skip to content

Commit d045603

Browse files
Cleaner [I'll squash this later]
1 parent 2297b20 commit d045603

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

openapi3/schema.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -858,9 +858,7 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
858858
name of the target schema. In the example above, the objectType property should
859859
contain either simpleObject, or complexObject string.''*/
860860
for _, oneof := range schema.OneOf {
861-
/* TODO: ugly.. should this be a property of the SchemaRef? */
862-
objectType := strings.ReplaceAll(oneof.Ref, "#/components/schemas/", "")
863-
if objectType == discriminatorVal {
861+
if strings.HasSuffix(oneof.Ref, discriminatorVal.(string)) {
864862
return oneof.Value.visitJSON(settings, value)
865863
}
866864
}

0 commit comments

Comments
 (0)