-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When using JavaSpring, together with JsonNullable, generated classes for child objects does not call parent setter properly, for the fluent setters.
Parent setter takes a JsonNullable but child just calls the setter with actual type argument.
Instead, the fluent setter of the child, should call the fluent setter of the parent for consistency.
openapi-generator version
7.0.0 not a regression
OpenAPI declaration file content or url
https://gist.github.com/robinjhector/a6391f8df4b6d0343d9d20c808d1107c
Generation Details
Maven generator:
<build>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<id>generateServerApi</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/my-api.yaml</inputSpec>
<generatorName>spring</generatorName>
<packageName>com.company.api</packageName>
<apiPackage>com.company.generatedapi</apiPackage>
<invokerPackage>com.company..generatedapi.invoker</invokerPackage>
<modelPackage>com.company..generatedapi.model</modelPackage>
<generateModelDocumentation>false</generateModelDocumentation>
<generateApiDocumentation>false</generateApiDocumentation>
<configOptions>
<oas3>true</oas3>
<useSpringBoot3>true</useSpringBoot3>
<dateLibrary>java8</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<delegatorPattern>false</delegatorPattern>
<interfaceOnly>true</interfaceOnly>
<useOptional>true</useOptional>
<performBeanValidation>true</performBeanValidation>
<singleContentTypes>true</singleContentTypes>
<unhandledException>false</unhandledException>
<generateApiTests>false</generateApiTests>
<skipDefaultInterface>true</skipDefaultInterface>
<useSwaggerUI>false</useSwaggerUI>
<documentationProvider>none</documentationProvider>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>Steps to reproduce
Run a generate either via cli or via maven plugin.
Parent:

Child (The output code has compilation errors, when it tries to call the parent setter):

Related issues/PRs
N/A
Suggest a fix
My suggestion is to use the parent fluent setter from the child class.
I am happy to submit a PR with a fix.
Reactions are currently unavailable