[BUG] Model name prefix brakes model inheritance
Created by: ZwoCa
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output?
Description
When generating for a YAML containing model composition / inheritance (for example the petstore-with-fake-endpoints-models-for-testing.yaml, see link below) and using the --model-name-prefix
CLI parameter for setting a custom prefix for the generated models, the inheritance is not paid respect to correctly.
To stay with the example: Instead of only generating the fields and methods for className and color only in the MyPrefixAnimal class, it is generating both in the MyPrefixAnimal class and in its subclasses MyPrefixDog and MyPrefixCat. If one ommits the prefix CLI parameter, everything works fine and the fields and methods will be generated only where they are meaningful.
openapi-generator version
I tested it with 4.0.0, 4.1.0-SNAPSHOT and 5.0.0-SNAPSHOT and various generators (jaxrs-jersey, jaxrs-cxf, python) and was able to observe the problem in all cases.
OpenAPI declaration file content or url
Command line used for generation
java -jar openapi-generator-cli-4.0.0.jar generate -i petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o wrongInheritance --model-name-prefix MyPrefix
Steps to reproduce
Use the command line above with the example from the repo and the generated MyPrefixCat model will be wrong.