Skip to content

Commit e040fdf

Browse files
author
Aidan Cunniffe
committed
Revert "Merge branch 'main' into pkg-snapshot-dirname"
This reverts commit 699981d, reversing changes made to a2fdd15.
1 parent 2656bc8 commit e040fdf

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

README.md

+70-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ https://raw.githubusercontent.com/opticdev/bookstore-example/ac5f3c55a6f7f27c482
4141

4242
<img src="https://github.com/opticdev/optic/assets/5900338/fd6cdd7f-c147-467b-9517-84232baa898f" width="500" />
4343

44+
[Read Documentation](https://www.useoptic.com/docs/diff-openapi)
4445

4546
## Test the accuracy of your documentation using `optic capture`
4647
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.
@@ -104,9 +105,10 @@ optic capture openapi.yml --update=interactive
104105
<img width="604" alt="Screenshot 2023-09-08 at 2 12 15 PM" src="https://github.com/opticdev/optic/assets/18374483/c7c540c8-2501-4824-aac6-049587e29c0a">
105106

106107

108+
[Read Documentation](https://www.useoptic.com/docs/verify-openapi)
107109

108110
## Improve your API design with `optic diff`
109-
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.
110112

111113

112114
<img src="https://github.com/opticdev/optic/assets/5900338/50a43d09-f531-405b-8b53-1c91ff5b8201" width="500" />
@@ -171,6 +173,73 @@ ruleset:
171173
require_operation_id: true
172174
```
173175
176+
[Read documentation](https://www.useoptic.com/docs/style-guides)
177+
178+
179+
## Start running in CI
180+
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.
213+
214+
```yaml
215+
# .gitlab-ci.yml
216+
optic-default-branch-push:
217+
image: node:latest
218+
rules:
219+
- if: $CI_PIPELINE_SOURCE == "push" && OPTIC_TOKEN && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
220+
script:
221+
- npm install -g @useoptic/optic
222+
- optic run
223+
224+
optic-merge-request:
225+
image: node:latest
226+
rules:
227+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $OPTIC_TOKEN
228+
script:
229+
- npm install -g @useoptic/optic
230+
- export OPTIC_RESULT=0; optic run || export OPTIC_RESULT=$?
231+
- if [ $OPTIC_RESULT -ne 0 ]; then exit 1; fi;
232+
```
233+
234+
235+
<img src="https://github.com/opticdev/optic/assets/5900338/18eb381a-59aa-42af-975a-36d1f24a5978" width="500" />
236+
237+
238+
## Resources
239+
- [Read our full documentation here](https://www.useoptic.com/docs)
240+
- [Need help? Book office hours](https://calendly.com/optic-onboarding/optic-office-hours)
241+
- [Join us on Discord](https://discord.com/invite/t9hADkuYjP)
242+
174243

175244
### License
176245
Optic is MIT Licensed

0 commit comments

Comments
 (0)