OpenAPITools / OpenAPITools/openapi-generator
[BUG] Extend of "Serializable" interface is missing in generated helper class "AbstractOpenApiSchema"
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
We are using the Java-generator and there we are using the serializableModel option to get the implementation of the Serializable-interface in every class. We need this for out interfac class processing and the implementation of the webservice. This option works fine in the classes besides the generated helper class AbstractOpenApiSchema. This missing "implements"-declaration does lead to internal error in our object processing at runtime.
Workaround
Currently we added the interface manually in the class. By adding this we are reaching the full functionality again.
openapi-generator
Replaceable with 7.1.0 and 7.2.0.
OpenAPI declaration file content or url
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- specify the swagger yaml -->
<inputSpec>${project.basedir}/api/GenericCognitiveServiceProvider.yaml</inputSpec>
<!-- target to generate java client code -->
<generatorName>java</generatorName>
<packageName>de.ser.doxis4.commons.machinelearning.types.genericprovider.generated</packageName>
<apiPackage>de.ser.doxis4.commons.machinelearning.types.genericprovider.generated.api</apiPackage>
<modelPackage>de.ser.doxis4.commons.machinelearning.types.genericprovider.generated.model</modelPackage>
<output>${project.basedir}</output>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
<skipOperationExample>false</skipOperationExample>
<strictSpec>true</strictSpec>
<supportingFilesToGenerate>
Authentication.java,HttpBasicAuth.java,HttpBearerAuth.java,ApiKeyAuth.java,AbstractOpenApiSchema.java,ApiClient.java,ApiException.java,ApiResponse.java,Configuration.java,JavaTimeFormatter.java,JSON.java,Pair.java,RFC3339DateFormat.java,ServerConfiguration.java,ServerVariable.java,StringUtil.java
</supportingFilesToGenerate>
<library>jersey2</library>
<configOptions>
<serializationLibrary>jackson</serializationLibrary>
<!-- must be added so that the classes work also with CXF of REST webservice -->
<serializableModel>true</serializableModel>
<dateLibrary>java8</dateLibrary>
<legacyDiscriminatorBehavior>false</legacyDiscriminatorBehavior>
<useOneOfDiscriminatorLookup>true</useOneOfDiscriminatorLookup>
<useOneOfInterfaces>false</useOneOfInterfaces>
<annotationLibrary>swagger2</annotationLibrary>
<disallowAdditionalPropertiesIfNotPresent>false</disallowAdditionalPropertiesIfNotPresent>
<useBeanValidation>true</useBeanValidation>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Java generator and the AbstractOpenApiSchema helper class named in the report, using the provided Maven configuration and serializableModel=true setting. Confirm that generated model classes and the generated helper class handle Serializable consistently, and verify that the helper class declares the interface in the generated output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100