0

My organization has a lot of APIs for different projects. I need an OpenAPI implementation that allows me to create a standalone portal that contains all these APIs (more like a repository) for all our products.

Is there an OpenAPI that supports this?

Another option would be: to be able to merge several instances to a single OpenAPI instance.

Anthon
  • 69,918
  • 32
  • 186
  • 246
waletoye
  • 364
  • 2
  • 9
  • Swagger UI can [display multiple API definitions](https://stackoverflow.com/a/45161533/113116). Is this what you need? – Helen Oct 02 '18 at 09:43
  • I think it does. However Swagger UI is too basic. @Helen does another implementation of OpenAPI (e.g. ReDoc or readme.io), have this feature? – waletoye Oct 02 '18 at 13:07

2 Answers2

1

There are several ways to implement API catalogs.

Swagger UI (open-source)

Swagger UI 3.0.19+ can display multiple API definitions using the url parameter.

// index.html

const ui = SwaggerUIBundle({
  dom_id: '#swagger-ui',
  urls: [
   {name: "petstore",  url: "http://petstore.swagger.io/v2/swagger.json"},
   {name: "instagram", url: "https://api.apis.guru/v2/specs/instagram.com/1.0.0/swagger.yaml"}
  ],
  "urls.primaryName": "petstore",  // default spec
  ...

Result:

Swagger UI top bar with spec selector

Since Swagger UI is open source, you can customize its layout and look&feel as your needs dictate.

SwaggerHub (commercial)

SwaggerHub provides API catalog hosting for teams & organizations, either in the cloud or on premises. SwaggerHub also supports API design, collaboration, code generation and workflow integrations among other things.

Disclosure: I work for the company that makes SwaggerHub.

SwaggerHub: API catalog

Helen
  • 87,344
  • 17
  • 243
  • 314
-1

To do that, a great solution is to use SwaggerHub as indicated. However, this tool is not free for private API. I had the same need, so, to help community in OpenAPI design, I wrote a new tool named "OpenAPI Dev Tool" (in github).

With OpenAPI Dev Tool, we can deploy several documentations (for several use contexts) for Swagger UI / Redoc with hot reload feature, like an SwaggerHub.

It is really easy to use.

Each API is indicated in a configuration file :

{
    "folder": "./specs",  // Root folder where the specifications are stored
    "specs": [            // Array of specifications (several specifications can be exposed)
        { // First specification file
            "file": "/petstore.yaml", // Relative path of the specification main file (from "folder" parameter). It has to be an OpenAPI file in YAML or JSON.
            "context": {    // Object used for template generation (see Template usage chapter below)
              ...
            }
        },
        { // Second specification file
        "file": "/petstore2.yaml"
            ...
        }
    ]
}

Then, you can serve the whole API just by hitting npx openapi-dev-tool serve Open your browser with http://localhost:3000 et voilà :)

gigaga
  • 1
  • 1