I want to generate our models based on an Openapi spec 3.0 yml definition. In my spec I have a definition using allOf
to include the fields of the other components. When generating the models with the openapi-generator-maven-plugin
. I see the following warning allOf with multiple schemas defined. Using only the first one
.
The result is that only the first allOf
definition's properties are included. While I expected all fields to be included. https://editor.swagger.io/ generates the schemas correct.
Why are not all properties defined in an allOf
included?
Schema definition:
Dto:
title: Dto
type: object
properties:
created_by:
type: string
format: date-time
Foo:
title: Foo
type: object
allOf:
- $ref: '#/Dto'
properties:
fooProperty:
type: string
Bar:
title: Bar
type: object
allOf:
- $ref: '#/Foo'
properties:
barProperty:
type: string
maven plugin configuration:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.1.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>myspec.yml</inputSpec>
<generatorName>spring</generatorName>
<generateApis>false</generateApis>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<serializableModel>true</serializableModel>
<documentationProvider>none</documentationProvider>
<openApiNullable>false</openApiNullable>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
The result is Bar
with only the fields of Dto
and Bar
but not those of Foo
.
Why are not all properties defined in an allOf
included?