Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.3K
Views
How to re-order endpoints on Swagger UI (OpenAPI)?

I have configured Swagger in my Spring boot application, the spring boot application has 2 controllers, casesController and AttachmentController, I want all the endpoints from my attachment controller appear after the case controller endpoints, but swagger is doing the opposite.

What swagger is doing: enter image description here

my code looks as follow:

Configuration file:

@Configuration
class OpenApiConfig(
    @Value("\${springdoc.info.title}") val title: String,
    @Value("\${springdoc.info.description}") val infoDescription: String,
    @Value("\${springdoc.info.version}") val version: String,
    @Value("\${springdoc.info.license.name}") val licenseName: String,
    @Value("\${springdoc.info.license.url}") val licenseUrl: String,
    @Value("\${springdoc.info.contact.email}") val email: String,
    @Value("\${springdoc.server.url}") val url: String,
    @Value("\${springdoc.server.description}") val description: String
) {
@Bean
fun customOpenAPIConfig(): OpenAPI {
    return OpenAPI()
            .components(
                    Components()
            )
            .info(
                    Info().title(title).description(infoDescription).version(version)
                            .license(License().name(licenseName).url(licenseUrl))
                            .contact(Contact().email(email))
            )
            .servers(listOf(Server().url(url).description(description)))
            .tags(listOf(Tag()))

 }
}

AttachmentController:

@RestController
@RequestMapping("/cases/{id}/attachments")
lass AttachmentController(private val caseManagementService: CaseManagementService) {

@Operation(
    summary = "Add attachment",
    tags = ["attachment"],
    description = "Add attachment to a case"
)
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
fun addAttachment(@RequestBody attachmentRequest: AttachmentRequestDto, @PathVariable id: String, @RequestHeader(value = "X-API-KEY") xApiKey: String): Mono<AttachmentResponseDto> {

    ....
}

CaseController:

@RestController
@RequestMapping("/cases")
class CaseController(private val caseManagementService: CaseManagementService) {

@Operation(
    summary = "Create case",
    tags = ["case"],
    description = "Create case"
)
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
fun createCase(@RequestBody caseRequest: CaseRequestDto, @RequestHeader(value = "X-API-KEY") xApiKey: String): Mono<CaseResponseDto> {

.... 
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Please have a look at my answer here

In brief one way is to use combination of @Tag and property springdoc.swagger-ui.tagsSorter=alpha

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!