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
{{ message }}
Repository navigation
[Java][okhttp-gson] oneOf with not: enum does not exclude matching string enum values #25065
The spec validates successfully with the OpenAPI Generator CLI. The validator only reports recommendations for unused models because there are no paths.
Current behavior
For Other.kind, the generated model validates that kind is a string, but does not enforce the nested:
not:
enum:
- known
As a result, {"kind":"known"} matches both Known and Other, and deserializing Union fails because two oneOf schemas match.
Expected behavior
The generated validation for Other.kind should reject "known", so:
{"kind":"known"} matches only Known
another string value such as {"kind":"other"} matches Other
Reproduction
With a generated Java client, deserializing {"kind":"known"} as Union currently fails with the oneOf multiple-match error.
A regression test covering both the known and unknown tag cases demonstrates the issue.
Proposed fix
For Java okhttp-gson, propagate string enum values from a property's composedSchemas.not metadata to the parent property and generate validation that rejects those values in pojo.mustache.
The change is intentionally limited to string enums under not; it does not claim general support for all not schemas or enum types.
Activity