Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ruozhixian opened this issue Sep 10, 2019 · 1 comment

Comments

@ruozhixian
Copy link

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.

@hkosova
Copy link

hkosova commented Sep 11, 2019

SwaggerHub has the concept of domains to store externally referenced components. You'll need to copy the contents of openapi-petstore-category.yml into a domain and update the $ref path to point to that domain.

Swagger Editor currently does not support relative references, this is tracked in swagger-api/swagger-editor#1409.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants