Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Microprofile OpenAPI oneOf in @Schema annotation/FISH-7376 #6265

Open
mreppe opened this issue Apr 17, 2023 · 1 comment
Open
Assignees
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect

Comments

@mreppe
Copy link

mreppe commented Apr 17, 2023

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

@mreppe mreppe added Status: Open Issue has been triaged by the front-line engineers and is being worked on verification Type: Bug Label issue as a bug defect labels Apr 17, 2023
@felixif felixif self-assigned this May 4, 2023
@felixif
Copy link

felixif commented May 4, 2023

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!

@felixif felixif added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev and removed Status: Open Issue has been triaged by the front-line engineers and is being worked on verification labels May 4, 2023
@felixif felixif changed the title Bug Report: Microprofile OpenAPI oneOf in @Schema annotation Bug Report: Microprofile OpenAPI oneOf in @Schema annotation/FISH-7376 May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect
Projects
None yet
Development

No branches or pull requests

2 participants