Skip to content

Commit 1e31a0a

Browse files
Compliance
1 parent b343c1d commit 1e31a0a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

openapi3/schema.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,14 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
841841

842842
if schema.Discriminator != nil {
843843
/* Find mapped object by ref */
844-
if valuemap, okcheck := value.(map[string]interface{}); okcheck {
844+
if valuemap, okcheck := value.(map[string]string); okcheck {
845845
pn := schema.Discriminator.PropertyName
846846
if discriminatorVal, okcheck := valuemap[pn]; okcheck {
847847
if len(schema.Discriminator.Mapping) > 0 {
848-
if mapref, okcheck := schema.Discriminator.Mapping[discriminatorVal.(string)]; okcheck {
849-
for _, item := range v {
850-
if item.Ref == mapref {
851-
return item.Value.visitJSON(settings, value)
848+
if mapref, okcheck := schema.Discriminator.Mapping[discriminatorVal]; okcheck {
849+
for _, oneof := range v {
850+
if oneof.Ref == mapref {
851+
return oneof.Value.visitJSON(settings, value)
852852
}
853853
}
854854
}
@@ -857,9 +857,9 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
857857
``It is implied, that the property to which discriminator refers, contains the
858858
name of the target schema. In the example above, the objectType property should
859859
contain either simpleObject, or complexObject string.''*/
860-
for _, oneof := range schema.OneOf {
861-
if strings.HasSuffix(oneof.Ref, discriminatorVal.(string)) {
862-
return oneof.Value.visitJSON(settings, value)
860+
for _, v := range schema.OneOf {
861+
if strings.HasSuffix(v.Ref, discriminatorVal) {
862+
return v.Value.visitJSON(settings, value)
863863
}
864864
}
865865
}

0 commit comments

Comments
 (0)