Description
Describe the bug
I am trying to define a response type that looks like the following in OpenAPI.
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/SubClassADto'
- $ref: '#/components/schemas/SubClassBDto'
- $ref: '#/components/schemas/SubClassCDto'
I'm using the following MicroProfile OpenAPI annotations to do so.
@APIResponse(responseCode = "200", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(type = SchemaType.ARRAY, anyOf = { SubClassADto.class, SubClassBDto.class, SubClassCDto.class })))
However, Quarkus' MicroProfile OpenAPI generator does not generate the proper OpenAPI specification for either anyOf or oneOf. It is generating a invalid specification that does not make sense instead.
Expected behavior
The Quarkus' MicroProfile OpenAPI generator should generate the following specification for an array type that utilizes the anyOf or oneOf field.
anyOf:
@Schema(type = SchemaType.ARRAY, anyOf = { ... })
schema:
type: array
items:
anyOf:
- ...
oneOf:
@Schema(type = SchemaType.ARRAY, oneOf= { ... })
schema:
type: array
items:
oneOf:
- ...
Actual behavior
The Quarkus' MicroProfile OpenAPI generator presently generates the following specification for an array type that utilizes the anyOf or oneOf field.
anyOf:
@Schema(type = SchemaType.ARRAY, anyOf = { ... })
schema:
type: array
anyOf:
- ...
oneOf:
@Schema(type = SchemaType.ARRAY, oneOf= { ... })
schema:
type: array
oneOf:
- ...
How to Reproduce?
Reproducer: https://github.com/colesturza/quarkus-microprofile-openapi-bug-reproducer
Output of uname -a
or ver
Linux desktop 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk version "17.0.8" 2023-07-18
OpenJDK Runtime Environment (build 17.0.8+7-Ubuntu-122.04)
OpenJDK 64-Bit Server VM (build 17.0.8+7-Ubuntu-122.04, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.16.11.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Tested with Gradle 8.2.1
and Apache Maven 3.9.3
Additional information
No response