swagger-api / swagger-api/swagger-codegen

[Spring] basePath not supported in openapi: 3.0.2

Open
#10,987 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I want to generate APIs with prefix "/api/v1/" (ex: "/api/v1/pets"). If I define it like this all APIs are added to a single interface "ApiApi". I want to be able to define APIs as "/api/v1/pets", while still having separate API interface objects (ex: PetsApi) and controllers (ex: PetsApiController). I tried to use basePath but it is not supported

Swagger-codegen version

3.0.24 swagger-codegen-maven-plugin

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 OpenAPI 3.0.2 definition and the swagger-codegen-maven-plugin 3.0.24 Spring generator behavior, then inspect the generator templates and basePath handling. Done means APIs retain separate interfaces and controllers such as PetsApi and PetsApiController while using the /api/v1/ prefix.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, spring
Domain
api, backend, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.