Closed jspetrak closed 11 months ago
Yet present in 7.0.0 beta.
Hi @jspetrak, this issue should be fixed in the latest release, version 7.0.1. The fix was contributed by @robinjhector via https://github.com/OpenAPITools/openapi-generator/pull/16497 .
As an aside, you might want to fix the below lines of your input spec:
discriminator:
propertyName: objectType
According to https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/
The
discriminator
is used withanyOf
oroneOf
keywords only.
and
It is important that all the models mentioned [...] contain the property that the discriminator specifies.
Does my fix solve the problem @jspetrak? Otherwise let me know!
@martin-mfg @robinjhector I tested the 7.0.1 version against the openapi files and I agree, it now produces compilable code. Thank you!
I had no idea this had a bounty on it, and I'm not sure it was still active, otherwise feel free to sponsor my github profile or paypal, or buy me a coffee 😄
OpenAPI Generator: 7.0.0 beta, template "spring"
OpenAPI Specification: 3.0.3
Given test file reproduces the issue.
The parent ModifyTestObject has following setter generated
but the child object takes List instead and passes it to the super method.
Expected solutions
Either
ModifyNamedTestRequest::twoOptional
should not be generated at all, or twoOptional should takeJsonNullable<String>
as its parameter.Related Issues
Originally posted by @jspetrak in https://github.com/OpenAPITools/openapi-generator/issues/4128#issuecomment-1560978293
14765 [BUG][Java][Spring] openapiNullable - JsonNullable usage is based on nullable property instead of required property
14766 is potential fix
Bounty
This is a blocker for OSDM code generation into Java Spring Boot. Bileto is willing to sponsor the resolution of the issue by €500 bounty, other currency equivalent, or extra donation to Open API Collective.