Skip to content

Commit 9486687

Browse files
author
Sophia Marie Terry
committed
docs: update usage details
1 parent a5d66dc commit 9486687

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tools/spectral/ipa/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ The IPA validation uses [Spectral](https://docs.stoplight.io/docs/spectral/9ffa0
1414
To run the IPA validation locally, install necessary dependencies with `npm install` if you haven't already. Then, simply run:
1515

1616
```
17-
npm run ipa-validation
17+
npm run ipa-validation --file="{your/file/name}"
1818
```
1919

20-
This command will run Spectral CLI for the ruleset [ipa-spectral.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/ipa-spectral.yaml) on the raw [v2.yaml](https://github.com/mongodb/openapi/blob/main/openapi/.raw/v2.yaml) OpenAPI spec.
20+
This command will run Spectral CLI for the ruleset [ipa-spectral.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/ipa-spectral.yaml).
21+
22+
For use on the OpenAPI specification, run `npm run ipa-validation` from the root directory of the OpenAPI repo, which will validate the raw [v2.yaml](https://github.com/mongodb/openapi/blob/main/openapi/.raw/v2.yaml) OpenAPI spec.
2123

2224
The Spectral CLI can also be used to run the validation on any valid OpenAPI file (`json` or `yaml`).
2325

@@ -73,6 +75,8 @@ overrides:
7375
x-xgen-IPA-xxx-rule: 'off'
7476
```
7577

78+
or by changing the severity in your local `IPAXXX.yaml` file to `off`.
79+
7680
### CI/CD Integration
7781

7882
#### GitHub Actions Example
@@ -81,7 +85,7 @@ If you use GitHub Actions, you can define a workflow step to include IPA validat
8185

8286
```
8387
- name: IPA validation action
84-
run: npx spectral lint <openapi-spec-file> --ruleset=<spectral-ruleset-file>
88+
run: npx spectral lint <spec-file> --ruleset=<spectral-ruleset-file>
8589
```
8690

8791
or
@@ -90,7 +94,7 @@ or
9094
- name: IPA validation - Spectral GitHub action
9195
uses: stoplightio/spectral-action@2ad0b9302e32a77c1caccf474a9b2191a8060d83
9296
with:
93-
file_glob: <openapi-spec-file>
97+
file_glob: <spec-file>
9498
spectral_ruleset: <spectral-ruleset-file>
9599
```
96100

@@ -104,7 +108,7 @@ You can create a validation script similar to this:
104108

105109
```bash
106110
#!/bin/bash
107-
spectral lint <openapi-spec-file> --ruleset=<spectral-ruleset-file>
111+
spectral lint <spec-file> --ruleset=<spectral-ruleset-file>
108112
if [ $? -ne 0 ]; then
109113
echo "API validation failed"
110114
exit 1

0 commit comments

Comments
 (0)