question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenAPI: auto-add-tags feature uses superclass/interface name, rather than actual class name

See original GitHub issue

Describe the bug

Consider the following:

@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface AbstractReadOnlyResource<T> {
    @GET
    @Path("/{id}")
    T getById(@PathParam("id") long id);
}

and

@Path("/address")
public class AddressResource implements AbstractReadOnlyResource<Address> {
    @Override
    public Address getById(long id) {
        // Removed for brevity
    }
}

Expected behavior

The get operation of the /address/{id} path is tagged with Address Resource.

Actual behavior

The resource is tagged with Abstract Read Only Resource.

OpenAPI JSON contains

"paths" : {
  "/address/{id}" : {
    "get" : {
      "tags" : [ "Abstract Read Only Resource" ],
      "parameters" : [ {
        "name" : "id",
        "in" : "path",
        "required" : true,
        "schema" : {
          "format" : "int64",
          "type" : "integer"
        }
      } ],
    }
  }
}

Swagger UI shows:

image

How to Reproduce?

~Will add a link to a GitHub repo shortly.~

EDIT: A small reproducer project can be found here.

Output of uname -a or ver

Linux jbe-desktop 5.4.0-89-generic #100-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version “11.0.11” 2021-04-20

GraalVM version (if different from Java)

none

Quarkus version or git rev

2.4.0.Final

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

Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
phillip-krugercommented, Aug 11, 2022

Thanks @MikeEdgar !

1reaction
j-becommented, Dec 21, 2021

@phillip-kruger that is excellent news! thank you very much, looking forward to the release 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using OpenAPI and Swagger UI - Quarkus
This will automatically add tags to operations based on the Java class name. Environment variable: QUARKUS_SMALLRYE_OPENAPI_AUTO_ADD_TAGS. Show more.
Read more >
Swagger different classes in different namespaces with same ...
I got (more than) two Api POST endpoints. Each one needs a json as parameter. But when I use the same class name...
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
An OpenAPI definition can then be used by documentation generation tools to display the API, ... All field names in the specification are...
Read more >
Usage - OpenAPI Generator
The meta command creates a new Java class and template files, used for creating your own custom templates. openapi-generator-cli help meta. NAME.
Read more >
OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
All field names in the specification are case sensitive. ... feature, this section describes requests initiated other than by an API call, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found