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

OpenAPI.yaml with recursion #36677

Closed
KaiSuchomel opened this issue Oct 25, 2023 · 6 comments · Fixed by #36514
Closed

OpenAPI.yaml with recursion #36677

KaiSuchomel opened this issue Oct 25, 2023 · 6 comments · Fixed by #36514
Labels
Milestone

Comments

@KaiSuchomel
Copy link
Contributor

KaiSuchomel commented Oct 25, 2023

Describe the bug

With the current Quarkus (3.5.0.CR1) a recursion in the openapi.yaml file will occur.
When using Enum in a Collection (in my case a Set) the following openapi.yaml is generated:

openapi: 3.0.3
info:
  title: quarkus-openapi API
  version: 1.0.0-SNAPSHOT
paths:
  /hello:
    get:
      tags:
      - Greeting Resource
      responses:
        "200":
          description: OK
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    MyClass:
      description: MyClass Description
      type: object
      properties:
        myEnums:
          description: My Enum Set
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/MyEnum'
    MyEnum:
      $ref: '#/components/schemas/MyEnum'

The Enum MyEnum has a selfreference.

Expected behavior

The openapi.yaml should look like the following:

openapi: 3.0.3
info:
  title: quarkus-openapi API
  version: 1.0.0-SNAPSHOT
paths:
  /hello:
    get:
      tags:
      - Greeting Resource
      responses:
        "200":
          description: OK
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    MyClass:
      description: MyClass Description
      type: object
      properties:
        myEnums:
          description: My Enum Set
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/MyEnum'
    MyEnum:
      description: A special Enum
      enum:
      - VALUE_ONE
      - VALUE_TWO
      - VALUE_THREE
      type: string
  securitySchemes:
    SecurityScheme:
      type: http
      description: Authentication
      scheme: basic

Actual behavior

No response

How to Reproduce?

Under https://github.com/KaiSuchomel/quarkus_openapi i have created a small reproducer.

  1. Run Test org.acme.CheckOpenApiTest

With Quarkus 3.4.3 the CheckOpenApiTest is successfully running. With 3.5.0.CR1 not.

Output of uname -a or ver

5.15.0-87-generic #97-Ubuntu SMP Mon Oct 2 21:09:21 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10) OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)

Quarkus version or git rev

3.5.0.CR1

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /opt/apache/maven/apache-maven-3.9.0
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /home/kai/.jbang/cache/jdks/17
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-87-generic", arch: "amd64", family: "unix"

Additional information

No response

@KaiSuchomel KaiSuchomel added the kind/bug Something isn't working label Oct 25, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 25, 2023

/cc @EricWittmann (openapi), @MikeEdgar (openapi), @phillip-kruger (openapi)

@melloware
Copy link
Contributor

@KaiSuchomel you might have to report that here if its an OpenAPI issue: https://github.com/smallrye/smallrye-open-api/issues

@KaiSuchomel
Copy link
Contributor Author

@phillip-kruger Do you know in which quarkus version the fix will be available? I hope it will be 3.5.X.

@phillip-kruger
Copy link
Member

I think we can include this in 3.5.1. @MikeEdgar ?

@MikeEdgar
Copy link
Contributor

I think we can include this in 3.5.1. @MikeEdgar ?

That's fine with me. I don't see any limitations around using SR OpenAPI 3.7 with any of the recent versions (aside from 3.2 since there are behavior changes).

@phillip-kruger
Copy link
Member

Thanks @MikeEdgar for confirming. @KaiSuchomel I added the backport label on the PR that fix this, so depending on when we get that merged, it should be in a 3.5.x release

@quarkus-bot quarkus-bot bot added this to the 3.6 - main milestone Nov 2, 2023
@gsmet gsmet modified the milestones: 3.6 - main, 3.5.1 Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants