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

The absence of annotation confuses openapi/swagger #896

Closed
cescoffier opened this issue Sep 2, 2021 · 7 comments · Fixed by #901
Closed

The absence of annotation confuses openapi/swagger #896

cescoffier opened this issue Sep 2, 2021 · 7 comments · Fixed by #901
Labels
bug Something isn't working
Milestone

Comments

@cescoffier
Copy link

With resteasy reactive, you can omit some annotations.
For example, the following endpoint is valid:

@GET
@Path("/{id}")
public Response getOne(long id) {
    Movie movie = Movie.findById(id);
    if (movie == null) {
        return Response.status(404).build();
    } else {
        return Response.ok(movie).build();
    }
}

However, it confuses openapi/swagger and we can't invoke it from the Quarkus dev console:

image

@cescoffier
Copy link
Author

CC @phillip-kruger @geoand

@geoand
Copy link
Contributor

geoand commented Sep 2, 2021

Indeed. If the name of the variable matches the variable part of path, then it can be omitted

@phillip-kruger
Copy link
Member

We will have to add support for that in openapi. At the moment it will assume that is the body

@MikeEdgar
Copy link
Member

This is definitely a bug. There are unit tests specifically for this.

@MikeEdgar MikeEdgar added the bug Something isn't working label Sep 2, 2021
@phillip-kruger phillip-kruger changed the title The absence of annotation confuses openapi/swagget The absence of annotation confuses openapi/swagger Sep 3, 2021
@phillip-kruger
Copy link
Member

So the problem is not that it did not create the path param, that actually worked (see below). The problem is that it also added the response body for that param, and that should be omitted.

/movies/{id}:
    get:
      tags:
      - Movie Resource
      parameters:
      - name: id
        in: path
        required: true
        schema:
          format: int64
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              format: int64
              type: integer
      responses:
        "200":
          description: OK

@phillip-kruger
Copy link
Member

mmm, I can not recreate this in our tests in SmallRye....

phillip-kruger added a commit to phillip-kruger/smallrye-open-api that referenced this issue Sep 3, 2021
Signed-off-by:Phillip Kruger <phillip.kruger@gmail.com>
@phillip-kruger
Copy link
Member

Here the test in SmallRye, seems ok #899

I am still trying to recreate this.

phillip-kruger added a commit to phillip-kruger/smallrye-open-api that referenced this issue Sep 3, 2021
Signed-off-by:Phillip Kruger <phillip.kruger@gmail.com>
phillip-kruger added a commit that referenced this issue Sep 3, 2021
@phillip-kruger phillip-kruger added this to the 2.1.12 milestone Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants