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
References to some types are unnecessarily wrapped in JsonNullable, even though nullable: true isn't used. This happens for types generated from schemas that use oneOf or anyOf to list allowed combinations of required properties like this:
Also occurs when using java generator with spring library. Doesn't reproduce for jaxrs-spec generator.
Steps to reproduce
Generate code using openapi.yaml
generated ReferencingSchema.java has an unneccessary JsonNullable wrapper for its content attribute.
Related issues/PRs
Suggest a fix
My guess is that the generator sets isNullable to true on the schema in this code because the type is missing in the oneOf subschemas ; though I haven't been able to confirm this yet.
This shouldn't be done however because there is a type defined in the schema that includes the oneOf.
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
References to some types are unnecessarily wrapped in JsonNullable, even though
nullable: true
isn't used. This happens for types generated from schemas that use oneOf or anyOf to list allowed combinations of required properties like this:A workaround for this problem is to add
type: object
to each of the oneOf subschemas.openapi-generator version
Since version 7.x including 7.6.0-SNAPSHOT, doesn't occur in 6.x versions.
OpenAPI declaration file content or url
reproducer OpenAPI (+ extract of generated code):
https://gist.github.com/pvdbosch/1f26142fd9df792f7cba6cdff88dbc29
Generation Details
Also occurs when using java generator with spring library. Doesn't reproduce for jaxrs-spec generator.
Steps to reproduce
content
attribute.Related issues/PRs
Suggest a fix
My guess is that the generator sets
isNullable
totrue
on the schema in this code because the type is missing in the oneOf subschemas ; though I haven't been able to confirm this yet.This shouldn't be done however because there is a type defined in the schema that includes the oneOf.
The text was updated successfully, but these errors were encountered: