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
Copy file name to clipboardExpand all lines: docs/getting-started/2-installation.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Installation
2
2
3
-
You can install Spectral using [npm](https://www.npmjs.com/):
3
+
You can install Spectral using [npm](https://www.npmjs.com/).
4
+
5
+
To install the [Spectral CLI client](../guides/2-cli.md), use:
4
6
5
7
```bash
6
8
npm install -g @stoplight/spectral-cli
@@ -12,6 +14,18 @@ Or if you are a [Yarn](https://yarnpkg.com/) user:
12
14
yarn global add @stoplight/spectral-cli
13
15
```
14
16
17
+
To consume the [Spectral Javascript API](../guides/3-javascript.md), use:
18
+
19
+
```bash
20
+
npm install -g @stoplight/spectral-core
21
+
```
22
+
23
+
Or if you are a [Yarn](https://yarnpkg.com/) user:
24
+
25
+
```bash
26
+
yarn global add @stoplight/spectral-core
27
+
```
28
+
15
29
## Executable Binaries
16
30
17
31
If you don't have Node.js and/or npm/Yarn, use the standalone packages for [all major platforms](https://github.com/stoplightio/spectral/releases). The quickest way to install the appropriate package for your operating system is via this shell script:
Copy file name to clipboardExpand all lines: docs/guides/4d-overrides.md
+21-4Lines changed: 21 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
## Overrides
2
2
3
-
Previously Spectral supported exceptions, which were limited in their ability to target particular rules on specific files or parts of files, or change parts of a rule. Overrides are the much more powerful version of exceptions, with the ability to customize ruleset usage for different files and projects without having to duplicate any rules.
3
+
Previously Spectral supported exceptions, which were limited in their ability to target particular rules on specific files or parts of files or change parts of a rule. Overrides are the much more powerful version of exceptions, with the ability to customize ruleset usage for different files and projects without having to duplicate any rules.
4
4
5
5
Overrides can be used to apply rulesets on:
6
6
@@ -40,9 +40,9 @@ overrides:
40
40
41
41
JSON Pointers have a different syntax than JSON Paths used in the `given` component of a rule.
42
42
43
-
In JSON Pointers, path components are prefixed with a "/" and then concatenated to form the pointer.
43
+
In JSON Pointers, path components are prefixed with a `/` and then concatenated to form the pointer.
44
44
45
-
Since "/" has a special meaning in JSON pointer, it must be encoded as "~1" when it appears in a component, and "~" must be encoded as "~0".
45
+
Since `/` has a special meaning in JSON pointer, it must be encoded as `~1` when it appears in a component, and `~` must be encoded as `~0`.
46
46
47
47
You can test JSON Pointer expressions in the [JSON Query online evaluator](https://www.jsonquerytool.com/) by choosing "JSONPointer" as the Transform.
48
48
@@ -58,9 +58,11 @@ In the event of multiple matches, the order of definition takes place, with the
58
58
59
59
### Caveats
60
60
61
+
#### External Dependencies ($refs)
62
+
61
63
Overrides are only applied to the _root_ documents. If your documents have any external dependencies ($refs), the overrides won't apply.
62
64
63
-
**Example:**
65
+
Example:
64
66
65
67
Given the following 2 YAML documents:
66
68
@@ -123,3 +125,18 @@ While executing `spectral lint User.yaml` outputs:
123
125
```
124
126
No results with a severity of 'error' or higher found!
125
127
```
128
+
129
+
#### Extended Rulesets (extends)
130
+
131
+
Overrides aren't supported in other files through [extended rulesets (`extends`)](4b-extends.md). For example, if you create a ruleset file (`rulesetA`) that includes another file (`rulesetB`) through `extends`, overrides are ignored if you apply them to `rulesetB`.
132
+
133
+
However, you can use JS rulesets to inherit overrides. This example shows how to apply an override in `rulesetB`:
0 commit comments