Skip to content

Commit 5abf66f

Browse files
authored
Merge branch 'develop' into feat/expose-documentation-url
2 parents 25660e0 + cffce47 commit 5abf66f

File tree

100 files changed

+8221
-626
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+8221
-626
lines changed

.circleci/config.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ defaults:
2020
tags:
2121
only: /^v.*/
2222
node-versions: &node-versions
23-
- "12.22"
2423
- "14.21"
2524
- &node-maintenance-lts "16.20"
26-
- &node-active-lts "18.18"
27-
- &node-current "20.5"
25+
- &node-active-lts "18.20"
26+
- &node-current "20.17"
2827
pkg-cache-path: &pkg-cache-path /tmp/pkg-node-binaries
2928
ldid-version: &ldid-version 2.1.5-procursus7 # https://github.com/ProcursusTeam/ldid
3029

@@ -167,7 +166,7 @@ commands:
167166
- run:
168167
name: Install ldid
169168
working_directory: /tmp/ldid
170-
command: make install
169+
command: sudo make install
171170

172171
lint-code:
173172
steps:
@@ -193,12 +192,12 @@ commands:
193192
parameters:
194193
max-workers:
195194
type: integer
196-
default: 2
195+
default: 3
197196
steps:
198197
- run: yarn pretest
199198
- run:
200199
name: Run node tests
201-
command: yarn test.jest --maxWorkers=<< parameters.max-workers >>
200+
command: yarn test.jest --ci --maxWorkers=<< parameters.max-workers >>
202201

203202
test-harness:
204203
parameters:
@@ -212,7 +211,7 @@ commands:
212211
type: string
213212
max-workers:
214213
type: integer
215-
default: 2
214+
default: 3
216215
steps:
217216
- compute-hashes
218217
- restore_cache:
@@ -276,7 +275,7 @@ jobs:
276275
- test-harness:
277276
os: linux
278277
node-version: << parameters.node-version >>
279-
max-workers: 2
278+
max-workers: 3
280279

281280
test-browser:
282281
docker:
@@ -302,7 +301,7 @@ jobs:
302301
- test-harness:
303302
os: windows
304303
node-version: *node-active-lts
305-
max-workers: 2
304+
max-workers: 3
306305

307306
build-nix-binaries:
308307
docker:

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
/test-harness/tests/
33
/packages/*/dist
44
/packages/rulesets/src/oas/schemas/validators.ts
5+
/packages/rulesets/src/arazzo/schemas/validators.ts
56
/packages/*/CHANGELOG.md
67
packages/formatters/src/html/templates.ts

.github/CODEOWNERS

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
* @stoplightio/oss-spectral
22

3-
README.md @stoplightio/documentation
4-
5-
toc.json @stoplightio/documentation
6-
7-
/docs @stoplightio/documentation
8-
93
/packages/rulesets/src/asyncapi @magicmatatjahu @smoya @jonaslagoni

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![CircleCI](https://img.shields.io/circleci/build/github/stoplightio/spectral/develop)](https://circleci.com/gh/stoplightio/spectral) [![npm Downloads](https://img.shields.io/npm/dw/@stoplight/spectral-core?color=blue)](https://www.npmjs.com/package/@stoplight/spectral-core) [![Stoplight Forest](https://img.shields.io/ecologi/trees/stoplightinc)][stoplight_forest]
33

44
- **Custom Rulesets**: Create custom rules to lint JSON or YAML objects
5-
- **Ready-to-use Rulesets**: Validate and lint **OpenAPI v2 & v3.x** and **AsyncAPI** Documents
5+
- **Ready-to-use Rulesets**: Validate and lint **OpenAPI v2 & v3.x**, **AsyncAPI**, and **Arazzo v1** Documents
66
- **API Style Guides**: Automated [API Style Guides](https://stoplight.io/api-style-guides-guidelines-and-best-practices?utm_source=github.com&utm_medium=referral&utm_campaign=github_repo_spectral) using rulesets improve consistency across all your APIs
77
- **Ready-to-use Functions**: Built-in set of functions to help [create custom rules](https://meta.stoplight.io/docs/spectral/e5b9616d6d50c-custom-rulesets#adding-rules). Functions include pattern checks, parameter checks, alphabetical ordering, a specified number of characters, provided keys are present in an object, etc.
88
- **Custom Functions**: Create custom functions for advanced use cases
@@ -40,10 +40,10 @@ There are also [additional installation options](https://meta.stoplight.io/docs/
4040

4141
Spectral, being a generic YAML/JSON linter, **needs a ruleset** to lint files. A ruleset is a JSON, YAML, or JavaScript/TypeScript file (often the file is called `.spectral.yaml` for a YAML ruleset) that contains a collection of rules, which can be used to lint other JSON or YAML files such as an API description.
4242

43-
To get started, run this command in your terminal to create a `.spectral.yaml` file that uses the Spectral predefined rulesets based on OpenAPI or AsyncAPI:
43+
To get started, run this command in your terminal to create a `.spectral.yaml` file that uses the Spectral predefined rulesets based on OpenAPI, Arazzo or AsyncAPI:
4444

4545
```bash
46-
echo 'extends: ["spectral:oas", "spectral:asyncapi"]' > .spectral.yaml
46+
echo 'extends: ["spectral:oas", "spectral:asyncapi", "spectral:arazzo"]' > .spectral.yaml
4747
```
4848

4949
If you would like to create your own rules, check out the [Custom Rulesets](https://meta.stoplight.io/docs/spectral/01baf06bdd05a-rulesets) page.
@@ -114,7 +114,7 @@ Check out some additional style guides here:
114114

115115
## 🏁 Help Others Utilize Spectral
116116

117-
If you're using Spectral for an interesting use case, [contact Stoplight](mailto:[email protected]) for a case study. 🎉
117+
If you're using Spectral for an interesting use case, create an issue with details on how you're using it. We'll add it to a list here. Spread the goodness 🎉
118118

119119
## 👏 Contributing
120120

docs/getting-started/1-concepts.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ To achieve this, Spectral has three key concepts:
88
- **Functions** accept a value and return issues if the value is incorrect.
99
- **Rulesets** act as a container for rules and functions.
1010

11-
Spectral comes bundled with a [set of core functions](../reference/functions.md) and rulesets for working with [OpenAPI v2 and v3](./4-openapi.md) and [AsyncAPI v2](./5-asyncapi.md) that you can chose to use or extend, but Spectral is about far more than just checking your OpenAPI/AsyncAPI documents are valid.
11+
Spectral comes bundled with a [set of core functions](../reference/functions.md) and rulesets for working with [OpenAPI v2 and v3](./4-openapi.md), [AsyncAPI v2](./5-asyncapi.md), and [Arazzo v1](./6-arazzo.md) that you can chose to use or extend, but Spectral is about far more than just checking your OpenAPI/AsyncAPI/Arazzo documents are valid.
1212

13-
By far the most popular use-case of Spectral is automating [API Style Guides](https://stoplight.io/api-style-guides-guidelines-and-best-practices?utm_source=github&utm_medium=spectral&utm_campaign=docs), implementing rules that your Architecture, DevOps, API Governance or "Center of Excellence" teams have decided upon. Companies generally write these style guides as wiki pages, and several can be found on [API Stylebook](http://apistylebook.com/), but most of these rules could be automated with Spectral. For example:
13+
By far the most popular use-case of Spectral is automating [API Style Guides](https://stoplight.io/api-style-guides-guidelines-and-best-practices?utm_source=github&utm_medium=spectral&utm_campaign=docs), implementing rules that your Architecture, DevOps, API Governance, "Center for Enablement", or "Center of Excellence" teams have decided upon. Companies generally write these style guides as wiki pages, and several can be found on [API Stylebook](http://apistylebook.com/), but most of these rules could be automated with Spectral. For example:
1414

1515
- Paths must be `/kebab-case` ([more ideas for URL rules](https://blog.stoplight.io/consistent-api-urls-with-openapi-and-style-guides))
1616
- HTTP Basic isn't allowed

docs/getting-started/3-rulesets.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ Rules take certain parameters and then call functions on parts of another YAML o
1010

1111
The fastest way to create a ruleset is to use the `extends` property to leverage an existing ruleset.
1212

13-
Spectral comes with two built-in rulesets:
13+
Spectral comes with three built-in rulesets:
1414

1515
- `spectral:oas` - [OpenAPI v2/v3 rules](./4-openapi.md)
1616
- `spectral:asyncapi` - [AsyncAPI v2 rules](./5-asyncapi.md)
17+
- `spectral:arazzo` - [Arazzo v1 rules](./6-arazzo.md)
1718

1819
To create a ruleset that extends both rulesets, open your terminal and run:
1920

2021
```bash
21-
echo 'extends: ["spectral:oas", "spectral:asyncapi"]' > .spectral.yaml
22+
echo 'extends: ["spectral:oas", "spectral:asyncapi", "spectral:arazzo"]' > .spectral.yaml
2223
```
2324

2425
The newly created ruleset file can then be used to lint any OpenAPI v2/v3 or AsyncAPI descriptions using the `spectral lint` command:

docs/getting-started/6-arazzo.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Arazzo Support
2+
3+
Spectral has a built-in [Arazzo v1](https://spec.openapis.org/arazzo/v1.0.0.html) ruleset that you can use to validate your Arazzo files.
4+
5+
Add `extends: "spectral:arazzo"` to your ruleset file to apply rules for Arazzo v1.
6+
7+
You can see a full list of the rules in this ruleset in [Arazzo Rules](../reference/arazzo-rules.md).

docs/guides/2-cli.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ spectral lint ./reference/**/*.oas*.{json,yml,yaml}
2727
Other options include:
2828

2929
```
30-
--version Show version number [boolean]
31-
--help Show help [boolean]
30+
--version Show version number [boolean]
31+
--help Show help [boolean]
3232
-e, --encoding text encoding to use
3333
[string] [choices: "utf8", "ascii", "utf-8", "utf16le", "ucs2", "ucs-2", "base64", "latin1"] [default: "utf8"]
3434
-f, --format formatters to use for outputting results, more than one can be provided by using
3535
multiple flags
36-
[string] [choices: "json", "stylish", "junit", "html", "text", "teamcity", "pretty", "github-actions", "sarif"]
36+
[string] [choices: "json", "stylish", "junit", "html", "text", "teamcity", "pretty", "github-actions", "sarif", "markdown","gitlab"]
3737
[default: "stylish"]
3838
-o, --output where to output results, can be a single file name, multiple "output.<format>" or
3939
missing to print to stdout [string]
@@ -61,6 +61,7 @@ Here you can build a [custom ruleset](../getting-started/3-rulesets.md), or exte
6161

6262
- [OpenAPI ruleset](../reference/openapi-rules.md)
6363
- [AsyncAPI ruleset](../reference/asyncapi-rules.md)
64+
- [Arazzo ruleset](../reference/arazzo-rules.md)
6465

6566
> If you use rules created or updated in a hosted [Stoplight API project](https://docs.stoplight.io/docs/platform/branches/pam-716-updated-landing-page/c433d678d027a-create-rules) with the Spectral CLI, you must publish the project from Stoplight before rule updates are used for linting.
6667

docs/guides/4-custom-rulesets.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Rulesets
22

3-
Spectral comes with two rulesets built-in: [OpenAPI](../reference/openapi-rules.md) and [AsyncAPI](../reference/asyncapi-rules.md). They're good starting points, but the true power of Spectral comes with customizing and creating a ruleset that fits your project or organization. Creating a ruleset can help you and your team improve your API design and API development process, and help you create better APIs.
3+
Spectral comes with three rulesets built-in: [OpenAPI](../reference/openapi-rules.md), [AsyncAPI](../reference/asyncapi-rules.md), and [Arazzo](../reference/arazzo-rules.md). They're good starting points, but the true power of Spectral comes with customizing and creating a ruleset that fits your project or organization. Creating a ruleset can help you and your team improve your API design and API development process, and help you create better APIs.
44

55
Let's look through the keywords that make up a ruleset, so you can learn how to tweak a distributed ruleset to work for you, or make your own ruleset from scratch to power your organizations [API Style Guide](https://stoplight.io/api-style-guides-guidelines-and-best-practices/?utm_source=github&utm_medium=spectral&utm_campaign=docs).
66

@@ -22,6 +22,7 @@ Rules are the most important part of a ruleset. For more details on rules and it
2222

2323
Formats are an optional way to specify which API description formats a rule, or ruleset, is applicable to. Currently Spectral supports these formats:
2424

25+
- `arazzo1_0` (Arazzo v1.0.x)
2526
- `aas2` (AsyncAPI v2.x)
2627
- `aas2_0` (AsyncAPI v2.0.0)
2728
- `aas2_1` (AsyncAPI v2.1.0)

0 commit comments

Comments
 (0)