swagger-api / swagger-api/swagger-codegen

How to view the APIs in SwaggerEditor / SwaggerHub and even to generate server code while it needs several files?

Open
#9,707 1 comment 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

For example, I define the Category in root yaml file as:

(openapi: 3.0.0)
components:
  schemas:
    Category:
      $ref: 'openapi-petstore-category.yml#/components/schemas/Category'

and the specific content of Category is defined in another file: openapi-petstore-category.yml.

It works well when I use the swagger-codegen-cli to generate spring server, just like
java -jar swagger-codegen-cli-3.0.11.jar generate -i ./oas3/root-petstore.yml -l spring -o petstore/test1/

However, if I want to see the APIs information in SwaggerEditor / SwaggerHub, it is allowed to just upload one file. And the root yaml file in SwaggerEditor / SwaggerHub appears the error "Could not resolve reference: Tried to resolve a relative URL , without having a basePath. path 'openapi-petstore-category.yml' basePath: 'undefined'"

Then I attempt to add the file's path in my computer as 'basePath', but it doesn't work.

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 with the root-petstore.yml example and its referenced openapi-petstore-category.yml file, then reproduce the relative-reference error in SwaggerEditor or SwaggerHub. Compare that behavior with the swagger-codegen-cli command shown; done would require a documented, supported way to view or process this multi-file definition, if the project owns that workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, yaml
Domain
documentation, tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.