swagger-api / swagger-api/swagger-codegen

Path parameters aren't propagated to operation level

Open
#12,365 0 comments 1 reaction 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

According to this line path level parameters are propagated to operation. However, the part && operation.getParameters() != null excludes this scenario, because operation relying on path level parameters (like GET /resource/{id}) will always have parameters == null. I'd recommend removing this condition because it doesn't contribute to propagating parameters from path to operation level

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 in modules/swagger-codegen/src/main/java/io/swagger/codegen/v3/DefaultGenerator.java around line 954, where path-level parameters are propagated to operations. Check the behavior for an operation with null parameters, such as GET /resource/{id}; done means path-level parameters appear at the operation level in generated output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.