'OpenAPI get Documentation only for one Path?


I'm using OpenAPI to Document a Microprofile application. As the Endpoint contains a large set of methods, I'd like to know if it's possible to filter through the /openapi REST, so that it returns just a specific Path, for example "/users". Thanks



Solution 1:[1]

You can have multiple paths selected. In openapi file the whole path section is called "paths" (so even the name is plural). If you're not sure how to use it, walk through openapi's in the "search" section of Swagger portal (you need to be logged in for this).

Example:

paths: 
  /{users}:
    options:
      security:
      summary: "Temp summary"
      description: "Temp description"
      tags: 
        - "TAG"
      parameters:
..
  /test/{table}:
    options:
      security:
      summary: "Temp summary"
      description: "Temp description"
      tags: 
        - "TAG"
      parameters:
..
  /test2/user/{id}:
    options:
      security:
      summary: "Temp summary"
      description: "Temp description"
      tags: 
        - "TAG"
      parameters:

Solution 2:[2]

as per our use case we found this to be working.

Annotate your endpoint with @Operation and add a hidden = true parameter to the annotation.

Here in Kotlin:

    @GET @Path("/{id}")
    @Operation(
        summary = "your summary",
        hidden = true
    )
    fun getDataset(@RestPath id: String): Response {
        ....
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PirrenCode
Solution 2 vlecoq-v