swagger-api / swagger-api/swagger-codegen

references to external files dont work on all levels

Open
#11,088 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

Depending on where a reference occurs, it is not resolved. This make modularization of distributed openapi spec files hard.

Swagger-codegen version

tested with 2.0.27, 2.0.23

Swagger declaration file content or url

worksnot.yaml:


openapi: 3.0.0
info:
  title: asdf
  description: |
    asdf
  contact: {}
  version: 0.0.0
servers:
- url: /v2
  description: server
paths:
  /works/worksnot:
    get:
      $ref: works_base.yaml#/paths/~1works~1/worksbase/get

works_base.yaml:

openapi: 3.0.0
info:
  title: asdf
  description: |
    asdf
  contact: {}
  version: 0.0.0
servers:
- url: /v2
  description: server
tags:
paths:
  /works/worksbase:
    get:
      summary: asdf

Command line used for generation

java -jar swagger-codegen-cli.jar generate -l openapi-yaml -i worksnot.yaml -o . -DoutputFile=works_r.yaml

Steps to reproduce

use above files and run comand line =>

works_r.yaml

openapi: 3.0.0
info:
  title: asdf
  description: |
    asdf
  contact: {}
  version: 0.0.0
servers:
- url: /v2
  description: server
paths:
  /works/worksnot:
    get: {}
components: {}

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 by reproducing the issue with worksnot.yaml, works_base.yaml, and the supplied java command, then inspect how external references are resolved during generation. Compare the working path-level $ref with references at other nesting levels. Done means external references resolve correctly in the generated works_r.yaml instead of producing an empty operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.