OpenAPITools / OpenAPITools/openapi-generator

Java Quarkus OpenAPI: How to order various paths in a Quarkus resource?

Open
#14,148 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

How can I add the sorting order for my API path endpoints using the Java OpenAPI annotations? I am currently using Quarkus to develop a rest-based application within that I am using the OpenAPI annotations to generate the Swagger-UI but I am not able to control the orders for various paths that appear. Is there a way to achieve this by forcing the OpenAPI to always sort as per my need?

Following are multiple resources and endpoints I have:

ExtensionsResource:

@Path("/api")
@Tag(
    name = "Extensions Controller",
    description = "Extensions Information")
public class ExtensionResource {

    @POST
    @Path("/post/extensions")
    public String list() {
        return extension;
    }

    @GET
    @Path("/get/extension")
    public String list() {
        return extension;
    }

    @POST
    @Path("/post/extension")
    public String list() {
        return extension;
    }
}

I always want to ensure that the swagger-ui displays the API endpoints in the following order:

1. api/get/extension
2. api/post/extension
3. api/post/extensions

This above code is just for reference my actual code looks different I just want to know how to force the ordering of endpoints in Swagger-UI using the OpenAPI annotation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported Quarkus resource annotations and the generated Swagger-UI path list. Determine whether endpoint ordering is configurable through the OpenAPI annotations or Swagger-UI configuration; done means documenting the supported approach or closing this as an unsupported request.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.