OpenAPI and Express with Optic

Connecting your API to Optic is basically finding a way to get an OpenAPI file that's representative of your API. If you already have an OpenAPI file that you write by hand or generate yourself, you can continue to our CI setup guides (GitHub or GitLab).

There are a couple of ways to generate an OpenAPI spec from your express app, the one we recommend is connecting up Optic to your integration tests to generate a spec.

Alternatively, there are some open source tools that you can use that also support OpenAPI spec generation:


Optic supports OpenAPI 3 and 3.1 - make sure that you opt-in to OpenAPI V3 generation when setting up your generator

Connecting to CI

Once you've set up a script that you can call to generate your OpenAPI spec (e.g. node ./src/generate-spec.js), you will be able to connect this up to Optic in CI to check for breaking changes and always keeping documentation in sync with the API and keep our OpenAPI accurate. Follow our CI setup guides (GitHub or GitLab).