Docker Image Version (tag latest semver)

Moira OpenAPI Specification

GSoC 2020 Project

The majority of this work is now part of the Moira documentation at https://github.com/moira-alert/doc/

The pre-built docker image is available on docker hub at idoko/moira-oas.

Usage

The OpenAPI description files are kept in a folder that corresponds to the path name. Components that are shared across OpenAPI operations live in the shared folder i.e:

  • shared/parameters: Contains the different parameters (they are all kept in a single _index.yml) file as they are not many enough to warrant individual files.
  • shared/responses: Responses that can be shared by different operations (such as errors)
  • shared/schemas: Schemas correspond to dto files in the main Moira repository. They usually live in their own files due to their size. See Issue #44 for details. To bundle them into a single yaml file, Install APIDevTools/swagger-cli globally with:
$ npm -i g swagger-cli

The command to merge them is already defined in the Makefile. To use it, run

$ make spec

And it will generate the final documentation file in build/openapi.yml

Additionally, you can view the documentation locally using Docker by running docker-compose in the project root directory.

$ docker-compose up

Once the containers are up, visit the URL at http://localhost:9900 to view the SwaggerUI documentation or http://localhost:9901 to view the Redoc version.

NOTE: To use the "Try it out" feature on SwaggerUI, ensure that enable_cors is set to true in your API config at /etc/moira/api.yml.

Thanks

SKB Kontur

Moira was originally developed and is supported by SKB Kontur, a B2G company based in Ekaterinburg, Russia. We express gratitude to our company for encouraging us to opensource Moira and for giving back to the community that created Graphite and many other useful DevOps tools.