我想根据 Openapi 规范 3.0 yml 定义生成模型。在我的规范中,我有一个定义,用于allOf包含其他组件的字段。使用 生成模型时openapi-generator-maven-plugin。我看到以下警告allOf with multiple schemas defined. Using only the first one。
结果是仅allOf包含第一个定义的属性。虽然我希望所有字段都包含在内。https://editor.swagger.io/生成正确的架构。
为什么不是所有属性都定义在allOfinclude 中?
架构定义:
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
Run Code Online (Sandbox Code Playgroud)
maven插件配置:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.1.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration> …Run Code Online (Sandbox Code Playgroud) java maven-plugin openapi openapi-generator openapi-generator-maven-plugin