Skip to content

Commit fdea3e9

Browse files
Merge branch 'develop' into feature-AT-458-scoring_data_customizable
2 parents 69cd341 + 6bbb6cb commit fdea3e9

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

docs/getting-started/2-installation.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Installation
22

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:
46

57
```bash
68
npm install -g @stoplight/spectral-cli
@@ -12,6 +14,18 @@ Or if you are a [Yarn](https://yarnpkg.com/) user:
1214
yarn global add @stoplight/spectral-cli
1315
```
1416

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+
1529
## Executable Binaries
1630

1731
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:

docs/guides/4d-overrides.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Overrides
22

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.
44

55
Overrides can be used to apply rulesets on:
66

@@ -40,9 +40,9 @@ overrides:
4040
4141
JSON Pointers have a different syntax than JSON Paths used in the `given` component of a rule.
4242

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.
4444

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`.
4646

4747
You can test JSON Pointer expressions in the [JSON Query online evaluator](https://www.jsonquerytool.com/) by choosing "JSONPointer" as the Transform.
4848

@@ -58,9 +58,11 @@ In the event of multiple matches, the order of definition takes place, with the
5858

5959
### Caveats
6060

61+
#### External Dependencies ($refs)
62+
6163
Overrides are only applied to the _root_ documents. If your documents have any external dependencies ($refs), the overrides won't apply.
6264

63-
**Example:**
65+
Example:
6466

6567
Given the following 2 YAML documents:
6668

@@ -123,3 +125,18 @@ While executing `spectral lint User.yaml` outputs:
123125
```
124126
No results with a severity of 'error' or higher found!
125127
```
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`:
134+
135+
```JavaScript
136+
import rulesetA from './ruleset';
137+
138+
export default {
139+
extends: rulesetA,
140+
overrides: rulesetA.overrides,
141+
};
142+
```

0 commit comments

Comments
 (0)