Payara
Payara copied to clipboard
Bug Report: Microprofile OpenAPI oneOf in @Schema annotation/FISH-7376
Brief Summary
If we use the oneOf property of the @Schema annotation, the Microprofiel OpenAPI Output is not as expected. The property is ignored.
Resource (see https://github.com/mreppe/payara6-openapi-oneof):
@PATCH
@RequestBody(
content = @Content(mediaType = MediaType.APPLICATION_JSON_PATCH_JSON,
schema = @Schema(oneOf = {TestEntityA.class, TestEntityB.class}))
)
public void testUpdate(JsonObject jsonObject) {
}
I tested on Payara Community 6.2023.3
Expected Outcome
openapi: 3.0.0
info:
title: Deployed Resources
version: 1.0.0
servers:
- url: http://localhost:8080/openapi-oneof
description: Default Server.
- url: https://localhost:8181/openapi-oneof
description: Default Server.
paths:
/resources/test:
patch:
operationId: testUpdate
requestBody:
content:
application/json-patch+json:
schema:
oneOf:
- $ref: '#/components/schemas/TestEntityA'
- $ref: '#/components/schemas/TestEntityB'
required: false
responses:
default:
content:
'*/*':
schema:
type: object
description: Default Response.
endpoints:
/openapi-oneof:
- /resources/test
components:
schemas:
TestEntityA:
exclusiveMaximum: false
exclusiveMinimum: false
minLength: 0
uniqueItems: false
maxProperties: 0
minProperties: 0
type: object
properties:
a:
type: string
nullable: false
readOnly: false
writeOnly: false
deprecated: false
TestEntityB:
exclusiveMaximum: false
exclusiveMinimum: false
minLength: 0
uniqueItems: false
maxProperties: 0
minProperties: 0
type: object
properties:
b:
type: string
nullable: false
readOnly: false
writeOnly: false
deprecated: false
Current Outcome
openapi: 3.0.0
info:
title: Deployed Resources
version: 1.0.0
servers:
- url: http://localhost:8080/openapi-oneof
description: Default Server.
- url: https://localhost:8181/openapi-oneof
description: Default Server.
paths:
/resources/test:
patch:
operationId: testUpdate
requestBody:
content:
application/json:
schema:
type: object
application/json-patch+json:
schema:
exclusiveMaximum: false
exclusiveMinimum: false
minLength: 0
uniqueItems: false
maxProperties: 0
minProperties: 0
nullable: false
readOnly: false
writeOnly: false
deprecated: false
required: false
responses:
default:
content:
'*/*':
schema:
type: object
description: Default Response.
endpoints:
/openapi-oneof:
- /resources/test
components:
schemas:
TestEntityA:
exclusiveMaximum: false
exclusiveMinimum: false
minLength: 0
uniqueItems: false
maxProperties: 0
minProperties: 0
type: object
properties:
a:
type: string
nullable: false
readOnly: false
writeOnly: false
deprecated: false
TestEntityB:
exclusiveMaximum: false
exclusiveMinimum: false
minLength: 0
uniqueItems: false
maxProperties: 0
minProperties: 0
type: object
properties:
b:
type: string
nullable: false
readOnly: false
writeOnly: false
deprecated: false
Reproducer
https://github.com/mreppe/payara6-openapi-oneof
Operating System
Ubuntu 22.04
JDK Version
openjdk 11.0.18 2023-01-17
Payara Distribution
Payara Server Full Profile
Hello @mreppe ,
I was able to easily reproduce the issue on both Payara 6.2023.3 and 6.2023.4. I have raised an internal issue FISH-7376, and one of our developers is going to pick up the issue as soon as possible. Thank you for your contribution!