You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenAPI 2.0 supports the discriminator field, but when the discriminator is included in an OpenAPI 2.0 document, unmarshaling the document fails.
OpenAPI 2.0 the discriminator field is set using string, whereas in OpenAPI 3.0 and later, the discriminator is represented as an object.
The unmarshaling process fails because the schema struct used for parsing expects the discriminator field to be an object, which is valid in OpenAPI 3.0 but not in OpenAPI 2.0.
This schema struct is shared between the OpenAPI v2.0 and v3.0+.
The solution is to update the type of the discriminator to interface{} (or any) and cast it based on the OpenAPI version, ensuring compatibility between versions.
OpenAPI 2.0 supports the discriminator field, but when the discriminator is included in an OpenAPI 2.0 document, unmarshaling the document fails.
OpenAPI 2.0 the discriminator field is set using
string
, whereas in OpenAPI 3.0 and later, the discriminator is represented as an object.The unmarshaling process fails because the schema struct used for parsing expects the discriminator field to be an object, which is valid in OpenAPI 3.0 but not in OpenAPI 2.0.
This schema struct is shared between the OpenAPI v2.0 and v3.0+.
The solution is to update the type of the discriminator to interface{} (or any) and cast it based on the OpenAPI version, ensuring compatibility between versions.
Example Payload with
discriminator
field setResponse
The text was updated successfully, but these errors were encountered: