You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Test the accuracy of your documentation using `optic capture`
46
47
It can be difficult to keep an OpenAPI in-sync with your implementation. Optic tests if your OpenAPI is accurate by capturing traffic from your tests and comparing it to the spec.
Optic is the first API linter built with the API lifecycle in-mind. When testing your API design, it always considers two versions of your API, for example: the version on the `develop` vs the `latest` release tag. This lets Optic check for all kinds of things Spectral (and other liners) misses like breaking changes and proper use of your API versioning scheme.
111
+
Optic is the first API linter built with the API lifecycle in-mind. When testing your API design, it always considers two versions of your API, for example: the version on the `develop` vs the `latest` release tag. This lets Optic check for all kinds of things [Spectral (and other liners) misses](https://www.useoptic.com/comparisons/spectral) like breaking changes and proper use of your API versioning scheme.
To start using Optic in CI, [follow this guide](https://www.useoptic.com/docs/setup-ci). We provide template workflows for GitHub and GitLab to help you run Optic as a CI check:
181
+
182
+
### Github
183
+
184
+
```yaml
185
+
# .github/workflows/optic.yml
186
+
name: optic
187
+
on:
188
+
pull_request:
189
+
push:
190
+
branches:
191
+
- "main"
192
+
193
+
jobs:
194
+
run:
195
+
runs-on: ubuntu-latest
196
+
steps:
197
+
- name: Checkout
198
+
uses: actions/checkout@v3
199
+
200
+
- name: Install Optic
201
+
run: npm install --location global @useoptic/optic
202
+
203
+
- name: Run Optic
204
+
env:
205
+
OPTIC_TOKEN: ${{ secrets.OPTIC_TOKEN }}
206
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
207
+
run: optic run
208
+
```
209
+
210
+
### Gitlab
211
+
212
+
Don't forget to add the `OPTIC_TOKEN` and `OPTIC_GITLAB_TOKEN` variables to your workflow.
0 commit comments