@quobix/vacuum 0.27.0 → 0.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  ![logo](logo.png)
2
2
 
3
- # vacuum - The world's fastest OpenAPI & Swagger linter.
3
+ # vacuum - The world's fastest OpenAPI and JSON Schema linter.
4
4
 
5
5
  ![build](https://github.com/daveshanley/vacuum/workflows/Build/badge.svg)
6
6
  [![Go Report Card](https://goreportcard.com/badge/github.com/daveshanley/vacuum)](https://goreportcard.com/report/github.com/daveshanley/vacuum)
7
7
  [![discord](https://img.shields.io/discord/923258363540815912)](https://discord.gg/UAcUF78MQN)
8
- [![Docs](https://img.shields.io/badge/godoc-reference-5fafd7)](https:/-/pkg.go.dev/github.com/daveshanley/vacuum)
8
+ [![Docs](https://img.shields.io/badge/godoc-reference-5fafd7)](https://pkg.go.dev/github.com/daveshanley/vacuum)
9
9
  [![npm](https://img.shields.io/npm/dm/@quobix/vacuum?style=flat-square&label=npm%20downloads)](https://www.npmjs.com/package/@quobix/vacuum)
10
10
  [![Docker Pulls](https://img.shields.io/docker/pulls/dshanley/vacuum?style=flat-square)](https://hub.docker.com/r/dshanley/vacuum)
11
11
  [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/avelino/awesome-go)
@@ -79,21 +79,32 @@ To run, mount the current working dir to the container and use a relative path t
79
79
  docker run --rm -v $PWD:/work:ro dshanley/vacuum lint <your-openapi-spec.yaml>
80
80
  ```
81
81
  Alternatively, you can pull it from
82
- [Github packages](https://github.com/daveshanley/vacuum/pkgs/container/vacuum).
82
+ [GitHub packages](https://github.com/daveshanley/vacuum/pkgs/container/vacuum).
83
83
  To do that, replace `dshanley/vacuum` with `ghcr.io/daveshanley/vacuum` in the above commands.
84
84
 
85
85
  ## Run with Go
86
86
 
87
- If you have go >= 1.16 installed, you can use `go run` to build and run it:
87
+ If you have Go 1.25 or newer installed, you can use `go run` to build and run it:
88
88
 
89
89
  ```
90
90
  go run github.com/daveshanley/vacuum@latest lint <your-openapi-spec.yaml>
91
91
  ```
92
92
 
93
+ ## Upgrade vacuum
94
+
95
+ If vacuum was installed with Homebrew, npm, or the shell installer, run:
96
+
97
+ ```bash
98
+ vacuum upgrade
99
+ ```
100
+
101
+ vacuum will detect the install path and use the matching upgrade mechanism when it can. Normal commands may also show an
102
+ update notice when a newer stable release is available. Use `--no-update-check` to skip that check for a single run.
103
+
93
104
  ---
94
105
 
95
106
  ## Sponsors
96
- If your company is using `vacuum`, please considering [supporting this project](https://github.com/sponsors/daveshanley),
107
+ If your company is using `vacuum`, please consider [supporting this project](https://github.com/sponsors/daveshanley),
97
108
  like our _very kind_ sponsors, past and present:
98
109
 
99
110
 
@@ -133,7 +144,13 @@ generating documentation with built-in linting results is available _right insid
133
144
  Try it out! instead of the `lint` command try the `docs` command instead.
134
145
 
135
146
  - [Read more about API Docs in vacuum](https://quobix.com/vacuum/api-docs/)
147
+ - [Read the `docs` command reference](https://quobix.com/vacuum/commands/docs/)
136
148
  - [Read more about the printing press](https://pb33f.io/printing-press/)
149
+ - [Learn about rendering modes](https://pb33f.io/printing-press/rendering-modes/)
150
+ - [Learn about diagnostics mode](https://pb33f.io/printing-press/diagnostics-mode/)
151
+ - [Learn about API catalogs](https://pb33f.io/printing-press/api-catalog/)
152
+ - [Learn about agentic AI output](https://pb33f.io/printing-press/agentic-ai/)
153
+ - [Learn about generated outputs](https://pb33f.io/printing-press/outputs/)
137
154
 
138
155
  ---
139
156
 
@@ -175,7 +192,7 @@ Ever needed to tweak an OpenAPI spec for different environments without maintain
175
192
  Maybe swap out server URLs between dev, staging, and production? Or perhaps strip out internal endpoints before publishing the API docs?
176
193
 
177
194
  OpenAPI Overlays are the answer. They let us make non-destructive modifications to specs using JSONPath expressions to
178
- target exactly what we want to change. vaccum now supports a new `apply-overlay` command.
195
+ target exactly what we want to change. vacuum now supports a new `apply-overlay` command.
179
196
 
180
197
  - [Learn more about the apply-overlay command](https://quobix.com/vacuum/commands/apply-overlay)
181
198
 
@@ -249,9 +266,9 @@ New rules:
249
266
 
250
267
  ---
251
268
 
252
- `v0.17`: **Github Action**.
269
+ `v0.17`: **GitHub Action**.
253
270
 
254
- vacuum now has an official Github Action. [Read the docs](https://quobix.com/vacuum/github-action/), or check it out
271
+ vacuum now has an official GitHub Action. [Read the docs](https://quobix.com/vacuum/github-action/), or check it out
255
272
  in the [GitHub Marketplace](https://github.com/marketplace/actions/vacuum-openapi-linter-and-quality-analysis-tool).
256
273
 
257
274
  ---
@@ -289,17 +306,25 @@ See all the documentation at https://quobix.com/vacuum
289
306
  - [Why should you care?](https://quobix.com/vacuum/why/)
290
307
  - [Concepts](https://quobix.com/vacuum/concepts/)
291
308
  - [FAQ](https://quobix.com/vacuum/faq/)
309
+ - [Ignoring lint results](https://quobix.com/vacuum/ignoring/)
310
+ - [Generate API Docs](https://quobix.com/vacuum/api-docs/)
292
311
  - [CLI Commands](https://quobix.com/vacuum/commands/)
293
312
  - [lint](https://quobix.com/vacuum/commands/lint/)
294
313
  - [vacuum report](https://quobix.com/vacuum/commands/report/)
314
+ - [docs](https://quobix.com/vacuum/commands/docs/)
295
315
  - [dashboard](https://quobix.com/vacuum/commands/dashboard/)
296
316
  - [html-report](https://quobix.com/vacuum/commands/html-report/)
297
317
  - [bundle](https://quobix.com/vacuum/commands/bundle/)
298
318
  - [spectral-report](https://quobix.com/vacuum/commands/spectral-report/)
299
319
  - [language-server](https://quobix.com/vacuum/commands/language-server/)
320
+ - [upgrade](https://quobix.com/vacuum/commands/upgrade/)
300
321
  - [apply-overlay](https://quobix.com/vacuum/commands/apply-overlay/)
301
322
  - [Change Detection](https://quobix.com/vacuum/commands/change-detection/)
302
323
  - [Open Collection](https://quobix.com/vacuum/commands/open-collection/)
324
+ - [Generate RuleSet](https://quobix.com/vacuum/commands/generate-ruleset/)
325
+ - [Version](https://quobix.com/vacuum/commands/version/)
326
+ - [External References](https://quobix.com/vacuum/commands/external-references/)
327
+ - [Exit Codes](https://quobix.com/vacuum/commands/exit-codes/)
303
328
  - [Developer API](https://quobix.com/vacuum/api/getting-started/)
304
329
  - [Using The Index](https://quobix.com/vacuum/api/spec-index/)
305
330
  - [RuleResultSet](https://quobix.com/vacuum/api/rule-resultset/)
@@ -364,7 +389,7 @@ No external dependencies, the HTML report will run completely offline.
364
389
 
365
390
  ---
366
391
 
367
- > **_Supports OpenAPI Version 2 (Swagger) and Version 3+_**
392
+ > **_Supports OpenAPI Version 2, OpenAPI Version 3+, and JSON Schema documents_**
368
393
 
369
394
  You can use either **YAML** or **JSON**, vacuum supports both formats.
370
395
 
@@ -481,7 +506,7 @@ recognizes a compressed report file and will deal with it automatically when rea
481
506
 
482
507
  ## Ignoring specific linting errors
483
508
 
484
- You can ignore specific linting errors by providing an `--ignore-file` argument to the `lint` and `report` commands.
509
+ You can ignore specific linting errors by providing an `--ignore-file` argument to commands that run or replay lint results, including `lint`, `report`, `spectral-report`, `html-report`, `dashboard`, and `docs`.
485
510
 
486
511
  ```
487
512
  ./vacuum lint --ignore-file <path-to-ignore-file.yaml> -d <your-openapi-spec.yaml>
@@ -491,8 +516,7 @@ You can ignore specific linting errors by providing an `--ignore-file` argument
491
516
  ./vacuum report --ignore-file <path-to-ignore-file.yaml> -c <your-openapi-spec.yaml> <report-prefix>
492
517
  ```
493
518
 
494
- The ignore-file should point to a .yaml file that contains a list of errors to be ignored by vacuum. The structure of the
495
- yaml file is as follows:
519
+ The ignore-file should point to a `.yaml` file that contains exact result paths or JSONPath expressions to be ignored by vacuum. The structure of the YAML file is as follows:
496
520
 
497
521
  ```
498
522
  <rule-id-1>:
@@ -525,7 +549,7 @@ if you're interested in seeing how things are progressing, it's available.
525
549
  If you're already using Spectral and you have your own [custom ruleset](https://meta.stoplight.io/docs/spectral/e5b9616d6d50c-custom-rulesets#custom-rulesets),
526
550
  then you can use it with vacuum!
527
551
 
528
- The `lint`, `dashboard` and `spectral-report` commands all accept a `-r` or `--ruleset` flag, defining the path to your ruleset file.
552
+ The `lint`, `dashboard`, `docs`, `html-report`, `report`, and `spectral-report` commands all accept a `-r` or `--ruleset` flag, defining the path to your ruleset file.
529
553
 
530
554
  ### Here are some examples you can try
531
555
 
@@ -549,7 +573,7 @@ The `lint`, `dashboard` and `spectral-report` commands all accept a `-r` or `--r
549
573
  ./vacuum lint -r rulesets/examples/custom-ruleset.yaml <your-openapi-spec.yaml>
550
574
  ```
551
575
 
552
- **_All rules, all of them!**
576
+ **_All rules, all of them!_**
553
577
  ```
554
578
  ./vacuum lint -r rulesets/examples/all-ruleset.yaml <your-openapi-spec.yaml>
555
579
  ```
@@ -588,10 +612,10 @@ Use `--nested-refs-doc-context` or `motor.ExecutionOptions{NestedRefsDocContext:
588
612
  ### File
589
613
  You can configure vacuum using a configuration file named `vacuum.conf.yaml`
590
614
 
591
- By default, vacuum searches for this file in the following directories
615
+ By default, vacuum searches for this file in the following locations:
592
616
  1. Working directory
593
- 2. `$XDG_CONFIG_HOME`
594
- 3. `${HOME}/.config`
617
+ 2. `$XDG_CONFIG_HOME`, when set
618
+ 3. `${HOME}/.config`, when `$XDG_CONFIG_HOME` is not set
595
619
 
596
620
  You can also specify a path to a file using the `--config` flag
597
621
 
@@ -609,9 +633,9 @@ lint:
609
633
  ...
610
634
  ```
611
635
 
612
- ### Environmental variables
636
+ ### Environment variables
613
637
 
614
- You can configure global vacuum flags using environmental variables in the form of: `VACUUM_<flag>`
638
+ You can configure global vacuum flags using environment variables in the form of: `VACUUM_<flag>`
615
639
 
616
640
  If a flag, has a `-` in it, replace with `_`
617
641
 
package/bin/vacuum.js CHANGED
@@ -6,11 +6,18 @@ import { fileURLToPath } from "url";
6
6
 
7
7
  const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = path.dirname(__filename);
9
+ const binaryName = process.platform === "win32" ? "vacuum.exe" : "vacuum";
9
10
 
10
11
  try {
11
- execFileSync(path.resolve(`${__dirname}/vacuum`), process.argv.slice(2), {
12
+ const env = {
13
+ ...process.env,
14
+ VACUUM_MANAGED_BY_NPM: "1",
15
+ VACUUM_MANAGED_PACKAGE_ROOT: path.resolve(`${__dirname}/..`),
16
+ };
17
+ execFileSync(path.resolve(__dirname, binaryName), process.argv.slice(2), {
12
18
  stdio: "inherit",
19
+ env,
13
20
  });
14
21
  } catch (e) {
15
- exit(1)
22
+ exit(typeof e.status === "number" ? e.status : 1)
16
23
  }
@@ -1,6 +1,6 @@
1
1
  import { createWriteStream } from "fs";
2
2
  import * as fs from "fs/promises";
3
- import fetch from "node-fetch";
3
+ import https from "https";
4
4
  import { HttpsProxyAgent } from "https-proxy-agent";
5
5
  import { pipeline } from "stream/promises";
6
6
  import * as tar from "tar";
@@ -18,6 +18,47 @@ function getProxyUrl() {
18
18
  null;
19
19
  }
20
20
 
21
+ function createRequestOptions() {
22
+ const proxyUrl = getProxyUrl();
23
+ if (!proxyUrl) {
24
+ return {};
25
+ }
26
+ console.log("Using proxy:", proxyUrl);
27
+ return { agent: new HttpsProxyAgent(proxyUrl) };
28
+ }
29
+
30
+ function requestUrl(url, options, redirectsRemaining = 5) {
31
+ return new Promise((resolve, reject) => {
32
+ const request = https.get(url, options, (response) => {
33
+ const { statusCode, headers } = response;
34
+ const location = headers.location;
35
+
36
+ if (statusCode >= 300 && statusCode < 400 && location) {
37
+ response.resume();
38
+ if (redirectsRemaining <= 0) {
39
+ reject(new Error("Too many redirects while fetching the binary"));
40
+ return;
41
+ }
42
+ const nextUrl = new URL(location, url).toString();
43
+ requestUrl(nextUrl, options, redirectsRemaining - 1).then(resolve, reject);
44
+ return;
45
+ }
46
+
47
+ resolve(response);
48
+ });
49
+ request.on("error", reject);
50
+ });
51
+ }
52
+
53
+ async function downloadFile(url, destination) {
54
+ const response = await requestUrl(url, createRequestOptions());
55
+ if (response.statusCode < 200 || response.statusCode > 299) {
56
+ response.resume();
57
+ throw new Error("Failed fetching the binary: " + response.statusMessage);
58
+ }
59
+ await pipeline(response, createWriteStream(destination));
60
+ }
61
+
21
62
  async function install() {
22
63
  if (process.platform === "android") {
23
64
  console.log("Installing, may take a moment...");
@@ -43,24 +84,11 @@ async function install() {
43
84
  url = url.replace(/{{version}}/g, version);
44
85
  url = url.replace(/{{bin_name}}/g, binName);
45
86
 
46
- // Configure fetch options with proxy support
47
- const fetchOptions = {};
48
- const proxyUrl = getProxyUrl();
49
- if (proxyUrl) {
50
- console.log('Using proxy:', proxyUrl);
51
- fetchOptions.agent = new HttpsProxyAgent(proxyUrl);
52
- }
53
-
54
- console.log('fetching from URL', url)
55
- const response = await fetch(url, fetchOptions);
56
- if (!response.ok) {
57
- throw new Error("Failed fetching the binary: " + response.statusText);
58
- }
59
-
60
87
  const tarFile = "downloaded.tar.gz";
61
88
 
62
89
  await fs.mkdir(binPath, { recursive: true });
63
- await pipeline(response.body, createWriteStream(tarFile));
90
+ console.log("fetching from URL", url);
91
+ await downloadFile(url, tarFile);
64
92
  await tar.x({ file: tarFile, cwd: binPath });
65
93
  await fs.rm(tarFile);
66
94
  }
@@ -72,4 +100,4 @@ install()
72
100
  .catch(async (err) => {
73
101
  console.error(err);
74
102
  process.exit(1);
75
- });
103
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quobix/vacuum",
3
- "version": "0.27.0",
3
+ "version": "0.27.2",
4
4
  "description": "The world's fastest, most scalable and complete OpenAPI parser",
5
5
  "type": "module",
6
6
  "author": "Dave Shanley",
@@ -11,7 +11,7 @@
11
11
  "url": "git+https://github.com/daveshanley/vacuum.git"
12
12
  },
13
13
  "engines": {
14
- "node": ">=16.0.0"
14
+ "node": ">=24.16.0"
15
15
  },
16
16
  "scripts": {
17
17
  "postinstall": "node ./npm-install/postinstall.js"
@@ -23,12 +23,11 @@
23
23
  "npm-install"
24
24
  ],
25
25
  "dependencies": {
26
- "https-proxy-agent": "^7.0.6",
27
- "node-fetch": "^3.3.2",
28
- "tar": "^7.5.13"
26
+ "https-proxy-agent": "^9.0.0",
27
+ "tar": "^7.5.15"
29
28
  },
30
29
  "devDependencies": {
31
- "@sourcemeta/jsonschema": "^11.5.1"
30
+ "@sourcemeta/jsonschema": "^15.6.3"
32
31
  },
33
32
  "bugs": {
34
33
  "url": "https://github.com/daveshanley/vacuum/issues"