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 Extension Misses Jackson Annotations on Methods that Return a Parameterized Type #45150

Closed
gilday opened this issue Dec 16, 2024 · 4 comments · Fixed by #45424
Closed
Labels
area/jackson Issues related to Jackson (JSON library) area/openapi area/smallrye kind/bug-thirdparty Bugs that are caused by third-party components and not causing a major dysfunction of core Quarkus.
Milestone

Comments

@gilday
Copy link
Contributor

gilday commented Dec 16, 2024

Describe the bug

Quarkus Smallrye OpenAPI extension doesn't respect Jackson JsonProperty annotation when that annotation is added to a method that returns a parameterized type.

package org.acme;

import com.fasterxml.jackson.annotation.JsonProperty;

public interface Named<T> {
  @JsonProperty("nombre")
  T name();
}

Image

Unexpectedly, replacing the type parameter with a concrete type resolves the issue.

Expected behavior

OpenAPI extension respects Jackson JsonProperty despite being on a method that returns a type parameter.

Actual behavior

No response

How to Reproduce?

Run the Quarkus dev server with the attached reproducer. Note the OpenAPI schema displayed by the Swagger UI.

The name property should be "nombre".

Output of uname -a or ver

Darwin MacBookPro 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "21.0.3" 2024-04-16 LTS OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)

Quarkus version or git rev

3.17.4

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

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937) Maven home: /Users/jgilday/.m2/wrapper/dists/apache-maven-3.9.9-bin/33b4b2b4/apache-maven-3.9.9 Java version: 21.0.3, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "15.1.1", arch: "aarch64", family: "mac"

Additional information

No response

@gilday gilday added the kind/bug Something isn't working label Dec 16, 2024
@quarkus-bot quarkus-bot bot added area/jackson Issues related to Jackson (JSON library) area/openapi area/smallrye labels Dec 16, 2024
Copy link

quarkus-bot bot commented Dec 16, 2024

/cc @EricWittmann (openapi), @MikeEdgar (openapi), @geoand (jackson), @gsmet (jackson), @mariofusco (jackson), @phillip-kruger (openapi)

@MikeEdgar
Copy link
Contributor

Can you share a reproducer project? I did a simple test with a generic return type and it seems to be ok in this case.

abstract class Named<T> {
    @JsonProperty("nombre")
    public abstract T name();
}

@Schema(name = "Widget")
class Widget extends Named<String> {
    public String name() {
        return "";
    }
}
{
  "openapi" : "3.1.0",
  "components" : {
    "schemas" : {
      "Widget" : {
        "type" : "object",
        "properties" : {
          "nombre" : {
            "type" : "string"
          }
        }
      }
    }
  }
}

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Dec 16, 2024
@gilday
Copy link
Contributor Author

gilday commented Dec 16, 2024

quarkus-openapi-schema-interface.zip

Sorry, I thought I already had attached the reproducer. It should be attached to this comment.

@MikeEdgar
Copy link
Contributor

Thanks for the reproducer. It looks like it works with a class but not a record. I'll keep debugging.

@geoand geoand removed the triage/needs-reproducer We are waiting for a reproducer. label Dec 16, 2024
@gsmet gsmet added kind/bug-thirdparty Bugs that are caused by third-party components and not causing a major dysfunction of core Quarkus. and removed kind/bug Something isn't working labels Dec 23, 2024
@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Jan 10, 2025
@gsmet gsmet modified the milestones: 3.18 - main, 3.17.7 Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jackson Issues related to Jackson (JSON library) area/openapi area/smallrye kind/bug-thirdparty Bugs that are caused by third-party components and not causing a major dysfunction of core Quarkus.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants