Вот минимальный пример (
Код: Выделить всё
openapi.yaml
Код: Выделить всё
openapi: 3.0.0
info:
title: Test
version: v1
paths:
/test:
get:
operationId: get
responses:
'200':
description: Get
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/A'
- $ref: '#/components/schemas/B'
components:
schemas:
A:
type: object
properties:
attA:
type: string
B:
type: object
properties:
attB:
type: integer
Код: Выделить всё
mvn org.openapitools:openapi-generator-maven-plugin:5.2.0:generate \
-Dopenapi.generator.maven.plugin.inputSpec=openapi.yaml \
-Dopenapi.generator.maven.plugin.generatorName=java
Код: Выделить всё
[WARNING] allOf with multiple schemas defined. Using only the first one: A
p>
Код: Выделить всё
DefaultApi api = new DefaultApi();
A a = api.get();
Код: Выделить всё
attA

Я создал проблему на GitHub, но, надеюсь, у кого-то здесь, возможно, была такая же проблема, и он справился чтобы это исправить.
Кроме того, я не могу изменить файл openapi.yaml, поскольку это спецификация OpenAPI, предоставляемая API, который мне нужно вызов, поэтому его изменение не имеет смысла и затруднит управление, если их спецификация OpenAPI со временем изменится.
Подробнее здесь: https://stackoverflow.com/questions/687 ... f-properly