Redoc: Loading multiple swagger files with ReDoc

Created on 30 Jan 2017  路  10Comments  路  Source: Redocly/redoc

Hello! I am looking for a solution or example for rendering multiple swagger spec files. Is there an existing/preferred solution for loading multiple swagger files, rather loading all APIs into a single yaml file (i.e. swagger.yaml in the demo code)?

add-to-faq question

Most helpful comment

Update, the multi-api example is now on the gh-pages branch:

https://github.com/Rebilly/ReDoc/blob/gh-pages/examples/multiple-apis/index.html

All 10 comments

Hey @katschre.

Check my answer to issue https://github.com/Rebilly/ReDoc/issues/163.

Let me know if it works for you or if you need any assistance.

In your demo code, can "swagger.yaml" be dynamically changed to specific specs? If I am following correctly, your swagger.yaml contains each of the apis in the demo. I'm looking to support upwards of 80 apis with ReDoc, so the loading time would suffer if it has to render all within one file. Please let me know if I am understanding your dynamic linking incorrectly!

From my point of view, since redoc is juste a simple client side app, you can create a basic HTML homepage with some links to your differents api.

Each API could be a link to a different "redoc" instance.

@nemenemsrouge thanks, you're absolutely correct 馃憤

If I am following correctly, your swagger.yaml contains each of the apis in the demo.

Probably you've mistaken something, our swagger.yaml contains spec of only ONE API with a lot of operations

@katschre summing up so far you have two options:

  • as proposed by @nemenemsrouge you can create a homepage with links to different API and each API page is another ReDoc instance. These pages may be as simple as our minimal setup demo: https://github.com/Rebilly/ReDoc#tldr each pointing to another spec
  • you can create one page with some buttons, selectbox, etc and javascript which tells redoc which spec to render. Example of this is our demo page: http://rebilly.github.io/ReDoc

I will create a few basic examples today so you can base your solution on

Here is an example of hosting multiple specs on the same page: https://github.com/Rebilly/ReDoc/blob/master/demo/examples/multiple-apis/index.html

Update, the multi-api example is now on the gh-pages branch:

https://github.com/Rebilly/ReDoc/blob/gh-pages/examples/multiple-apis/index.html

If it helps
created a small dashboard for presenting a catalog of services

https://github.com/dbones/ink

consider this a simple solution to this problem

I have written a docker image for that problem. If you are interested, you can use it :) Feel free: https://hub.docker.com/r/volbrene/redoc

@volbrene thank you for the docker image I like how you solved this issue, would you be open to putting the source code for this in Github so we could customize it for our use?

I have now published the git in Github. https://github.com/volbrene/redoc

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shreyas-agnihotri picture shreyas-agnihotri  路  3Comments

martnst picture martnst  路  3Comments

gavinkalika picture gavinkalika  路  3Comments

typekpb picture typekpb  路  4Comments

JFCote picture JFCote  路  3Comments