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
If you use inheritance with Java and you use readonly fields in the extended model (used in allOf) the generator will create a private field in the base class and inside the constructor of the main model there is a setter to the private field of the base class.
Generate the mentioned jetbrains youtrack api with any Java generator.
Related issues/PRs
Suggest a fix
Most simple way is to set the variables no longer as private but package or protected instead in Mustache template (this is my workaround for now).
This could be conditional so if the model is used in any allOf / inheritance scenario it should be package / protected scoped var
Most complex but most clean way is that instead of setting the vars directly in the constructor of the MainClass the already existing constructor of the baseclass with these readonly vars super(readOnly1, readOnly2) is called instead of this()
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
If you use inheritance with Java and you use readonly fields in the extended model (used in allOf) the generator will create a private field in the base class and inside the constructor of the main model there is a setter to the private field of the base class.
openapi-generator version
Checked with 5.4 and current master version
OpenAPI declaration file content or url
You can also check with the current version of Jetbrains Youtrack OAS: https://youtrack.jetbrains.com/api/openapi.json
Generated Class Project and base class is IssueFolder
Generation Details
Checked with the following Maven Config:
Steps to reproduce
Generate the mentioned jetbrains youtrack api with any Java generator.
Related issues/PRs
Suggest a fix
super(readOnly1, readOnly2)
is called instead ofthis()
The text was updated successfully, but these errors were encountered: