swagger-api / swagger-api/swagger-codegen

Reference to external files fails

Open
#10,431 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

All references to parameters in another file fail if any one reference to another file fails.

I have a yaml file where I have given references to parameters in another files. If one of the references fails due to a file missing then all the references present in the file present after that point in the file fail to work.

Swagger-codegen version

Code gen-Version : 3.0.21

Swagger declaration file content or url

For example I have below file swagger.yaml in which I give reference to another files responses.yaml and common.yaml

swagger. yaml

paths:
 /pets:
    get:
        responses:
               '400':
                   $ref: 'responses.yaml#/components/responses/400'
               '401': 
                   $ref:  'common.yaml#/components/responses/401'

Now if responses.yaml file is missing then the reference to common.yaml will also not work even though common.yaml is present.

Command line used for generation

java -jar swagger-codegen-cli-3.0.21.jar -i swagger.yaml -l html

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 issue with swagger.yaml, responses.yaml, and common.yaml using the documented swagger-codegen-cli-3.0.21 command and the html generator. Compare behavior when responses.yaml is missing; done means the valid reference to common.yaml still resolves instead of being skipped after the missing reference.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.