swagger-api / swagger-api/swagger-codegen

msf4j codegen doesn't include the basepath declaration

Open
#5,533 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

General: Suggestion Server: Java
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The command "swagger-codegen generate -l msf4j -i swagger.yaml" should use the basepath declaration if the basepath is included in the yaml file. This doesn't happen. Instead the generated API class ignores the basepath and excludes it from all generated @Path annotations.

Swagger-codegen version

2.2.2

Swagger declaration file content or url
basePath: /services/rest/V1-0
Command line used for generation

swagger-codegen generate -l msf4j -i swagger.yaml

Steps to reproduce

Any yaml with a basepath should produce code with no basepath included.

Related issues
Suggest a Fix

I would include the basepath declaration to the first @Path 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

Run swagger-codegen generate -l msf4j -i swagger.yaml with basePath: /services/rest/V1-0 in swagger.yaml, then inspect the generated API class and its @Path annotations. Trace the msf4j generator or template entry point used by the command. Done means the generated annotations include the declared base path.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.