[Java] Is there a way to reference other Domains in oas3, but not generate the models?
Description
I am attempting to build an object in Java from multiple smaller objects that can be referenced in multiple different Domains or APIs whose models are already generated and in use. Using the swagger-codegen-maven-plugin, I am able to generate and add cli options.
When I do generate the object, it will extend the first allOf entry and add the fields of all subsequent entries (expected and wanted). For the subsequent entries, it will still generate and import the model, which I would like to prevent.
Swagger-codegen version
version 3.0.25 (This is the version for swagger-codegen-maven-plugin)
Swagger declaration file content or url
MasterYml
components:
schemas:
MainObject:
allOf:
- $ref: 'some/path/SubYml#components/schemas/SubObject1' #want to extend and import
- $ref: 'some/path/SubYml#components/schemas/SubObject2' #only want fields
- $ref: 'some/path/SubYml#components/schemas/SubObject3' #only want fields
SubYml
components:
schemas:
SubObject1:
properties:
prop1: string
SubObject2:
properties:
prop2: string
SubObject3:
properties:
prop3: string
Results
This generates a class named MainObject that extends SubObject1 and contains all fields from SubObject2 and SubObject3 as well as generates and imports SubObject2 and 3. I would have already overridden the import for SubObject1 using the import mappings option to import the current existing object.
Again, the outcome I would like is to not generate the "extra" allOf models and just use them to apply their fields to the MainObject