swagger-api / swagger-api/swagger-codegen

CodegenOperation isMemberPath()

Open
#4,030 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Java help wanted Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

CodegenOperation methods isRestfulUpdate and isRestulDestroy has the condition of isMemberPath() which contains this login:

` if (pathParams.size() != 1) return false;

I believe it is valid for a REST call to contain multiple path param: eg. DELETE /org/{myOrg}/user/{myUser} and PATCH /org/{myOrg}/user/{myUser} (valid in my current model)

This is preventing me from properly using the isRestfulUpdate method within a mustache template.

Swagger-codegen version

2.2.1

Suggest a Fix

Remove the isMemberPath() references from the IsRestful* methods, or change condition to have if (pathParams.size() == 0) return false;

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

Locate CodegenOperation and inspect isMemberPath(), isRestfulUpdate(), and isRestulDestroy(); begin by tracing how pathParams is populated. Confirm the behavior through the mustache template that consumes the isRestful* methods, and verify that nested paths such as /org/{myOrg}/user/{myUser} are handled as intended.

Written by the indexing model from the issue text.

Assessment

Domain
backend-api-design
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.