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 schema generates breaking change for enum type when migrating from Quarkus 3.16 to 3.17 #45752

Open
cristianonicolai opened this issue Jan 21, 2025 · 4 comments
Labels

Comments

@cristianonicolai
Copy link
Contributor

Describe the bug

When migrating from Quarkus 3.16 to 3.17 using openapi version 3.0.3 the generated schema for an enum type creates a breaking change due to removing the type=string

Expected behavior

Generated schema is:

"status" : {
            "type" : "string",
            "allOf" : [ {
              "$ref" : "#/components/schemas/Status"
            } ],
            "nullable" : true
          }

Actual behavior

Field is annotated as:

@Schema(nullable = true) Status status

Generates:

"status" : {
            "allOf" : [ {
              "$ref" : "#/components/schemas/Status"
            } ],
            "nullable" : true
          }

How to Reproduce?

Created sample project with annotated POJOs here: https://github.com/cristianonicolai/quarkus-playground

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.17.7

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

Apache Maven 3.9.9

Additional information

No response

Copy link

quarkus-bot bot commented Jan 21, 2025

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

@MikeEdgar
Copy link
Contributor

I'm curious if this one is causing an issue or it is just flagged as a change. The base schema should use the type from Status via the $ref.

@cristianonicolai
Copy link
Contributor Author

Its been flagged as a breaking change since the type was dropped but indeed, it seems that the actual problem is that it should not be added at all in the first place by the previous SmallRye version. I tried annotating as @Schema(nullable = true, type = SchemaType.DEFAULT) but it still generates the String type on Quarkus 3.16

@MikeEdgar
Copy link
Contributor

it seems that the actual problem is that it should not be added at all in the first place by the previous SmallRye version

Can we consider it fixed in 3.17 in that case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants