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
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
We are using the Java generator with okhttp-gson. We have noticed that enum values are not validated consistently by the generated models.
With the example schema below, we have observed that the code generated by okhttp-gson generator works as follows when deserializing an object that matches the FooThing schema (i.e., it has a kind property with value foo):
FooThing deserializes the object without an error (correct)
BarThing throws an error that the object isn't valid according to the schema (correct)
Thing model doesn't validate the enum values, throws an error that the object matches both FooThing and BarThing (incorrect)
Container model, which only allows a BarThing, doesn't validate the enum value and does not throw a validation error (incorrect)
Bug Report Checklist
Description
We are using the Java generator with okhttp-gson. We have noticed that enum values are not validated consistently by the generated models.
With the example schema below, we have observed that the code generated by okhttp-gson generator works as follows when deserializing an object that matches the FooThing schema (i.e., it has a
kind
property with valuefoo
):FooThing
deserializes the object without an error (correct)BarThing
throws an error that the object isn't valid according to the schema (correct)Thing
model doesn't validate the enum values, throws an error that the object matches both FooThing and BarThing (incorrect)Container
model, which only allows aBarThing
, doesn't validate the enum value and does not throw a validation error (incorrect)openapi-generator version
v7.0.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
Generate
validateJsonElement
functions when using the Javaokhttp-gson
generatorThe text was updated successfully, but these errors were encountered: