swagger-api / swagger-api/swagger-codegen

Tags in swagger yaml breaks nodejs generated server

Open
#2,423 17 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have been having a hard time using the generated nodejs server to build a mock API based on my swagger yaml file. It turns out that my use of tags in the yaml causes the generated server to have multiples of the controllers I am expecting.

If I add a single tag as follows:

      tags:
        - HTTP Request

Then when making an API request with the generated server I get the following error

Error: Cannot resolve the configured swagger-router handler: HTTP Request_shopsShopIdTransactionsGET

Removing the tag will allow the server to identify the correct controller and respond.

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

Reproduce the failure with the supplied Swagger YAML tag and the generated Node.js server, then compare the generated controllers and swagger-router handler names with the tag removed. Trace the controller-generation and handler-resolution entry points referenced by the error; done means tagged operations produce one correct controller and the request resolves successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
api, backend
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.