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
I want to generate a class inheritated from imported external class.
In gradle task im using importMappings to import generated class from another yaml file.
In yaml file im using allOf and $ref to that class.
Class will be generated with import to that class but without of extends keyword.
Parent class must use x-parent or a discriminator to force inheritance instead of composition. Alternatively REF_AS_PARENT_IN_ALLOF normalization can be set.
The generator uses openapi contracts to analyze the structure and the hierarchy of the models.
There is no way to perform that with imported class.
If ParentClass is hand written in java, you can still make it work with some additional work.
Embedd a dummy ParentClass in your contract
ParentClass:
x-parent: true
type: object
Configure the generator with schemaMappings, importMapping, typeMappings.
'ParentClass': 'org.example.document.generated.model.ParentClass'
.openapi-generator-ignore could also contains **/ParentClass.java
With this config, the generator will skip the generation of ParentClass.java.
Add the jar containing it as a dependency so the compiler finds it
Bug Report Checklist
Description
I want to generate a class inheritated from imported external class.
In gradle task im using
importMappings
to import generated class from another yaml file.In yaml file im using allOf and $ref to that class.
Class will be generated with import to that class but without of extends keyword.
openapi-generator version
7.11.0
OpenAPI declaration file content or url
https://gist.github.com/p-migda/c32e0e2623024a00cd068343cc6c25d2
https://gist.github.com/p-migda/f9c211cfb5849cd3cc32841b3d0f63b4
Generation Details
using openapi-generator-gradle-plugin:
Steps to reproduce
Just run a gradleTask
Suggest a fix
Maybe something wrong is with setting a parent marker when parent class is imported from outside of file.
The text was updated successfully, but these errors were encountered: