Quarkus: @Parameters in = QUERY are left out in the openapi.json on Quarkus 1.4.2

Created on 22 May 2020  路  13Comments  路  Source: quarkusio/quarkus

Describe the bug
@Parameter with in = ParameterIn.Query are left out of the openapi.json, only the last @Parameter is actually show in openapi.json (and if it was explicitly defined in the signature as a @QueryParam

Expected behavior
All the parameters are listed in the openapi.json

Actual behavior
Only last @Parameter is shown and the ones that are set as @QueryParam in the method

To Reproduce

Steps to reproduce the behavior:

  1. Using Quarkus 1.4.2
  2. Add the follow endpoint
  @Operation(summary = "foo")
  @GET
  @Path("/foo")
  @Parameter(
          name="foo1",
          in = ParameterIn.QUERY,
          description = "Im foo 1"
  )
  @Parameter(
          name="foo2",
          in = ParameterIn.QUERY,
          description = "Im foo 2"
  )
  @Parameter(
          name="bar1",
          in = ParameterIn.QUERY,
          description = "Im bar 1"
  )
  @Parameter(
          name="bar2",
          in = ParameterIn.QUERY,
          description = "Im bar 2"
  )
  public Response foo(@QueryParam String foo1) {
    return Response.ok().build();
  }
  1. Get the openapi.json (e.g. by going to http://localhost:8080/swagger-ui)
  2. See how only foo1 and bar2 are show in there
  3. Move to Quarkus 1.4.1
  4. See how all params appears in the openapi.json

Environment (please complete the following information):

  • Output of uname -a or ver:
    Linux localhost.localdomain 5.0.6-200.fc29.x86_64 #1 SMP Wed Apr 3 15:09:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version:
    openjdk version "11.0.5" 2019-10-15
    OpenJDK Runtime Environment 18.9 (build 11.0.5+10)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.5+10, mixed mode, sharing)

  • GraalVM version (if different from Java):

  • Quarkus version or git rev:
    1.4.2

  • Build tool (ie. output of mvnw --version or gradlew --version):
    Maven home: /home/josejulio/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
    Java version: 11.0.5, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-11.0.5.10-0.fc29.x86_64
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "5.0.6-200.fc29.x86_64", arch: "amd64", family: "unix"

Additional context
Also tried with @Parameters annotation and the same effect

areopenapi kinbug

Most helpful comment

Hi @pilhuhn - I'll get a patch out for 1.5.1

All 13 comments

/cc @EricWittmann

/cc @phillip-kruger @MikeEdgar

@MikeEdgar @kenfinnigan
Changes that might cause this:
https://github.com/smallrye/smallrye-open-api/compare/1.2.1...1.2.3

Any idea ?

@phillip-kruger , definitely one of the two from Apr 6 or Apr 8, assuming this worked in an earlier version.

@phillip-kruger , the intent of that method is to match JAX-RS and OpenAPI annotations. If there is no match the method calling it is supposed to treat it as standalone.

@josejulio - are you using inheritance or interfaces with your JAX-RS resource class?

@josejulio - are you using inheritance or interfaces with your JAX-RS resource class?

No, this is the class that is showing the error: https://github.com/RedHatInsights/policies-ui-backend/blob/master/src/main/java/com/redhat/cloud/policies/app/rest/PolicyCrudService.java#L90

The reproducer triggers the error there.

This is definitely due to smallrye/smallrye-open-api#293. I'm thinking about how to rework that change.

This should be fixed once we pull in the next version of SmallRye. Thanks @MikeEdgar !

Could this PLEASE end up in Quarkus 1.4.3 or 1.5.1 ?

Hi @pilhuhn - I'll get a patch out for 1.5.1

9666 should fix this

Was this page helpful?
0 / 5 - 0 ratings