@quobix/vacuum 0.26.8 → 0.27.1

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
 
@@ -124,7 +135,26 @@ come say hi!
124
135
 
125
136
  ## Documentation
126
137
 
127
- 🔥 **New in** `v0.25` 🔥: **Generate Open Collections from OpenAPI files**
138
+ 🔥 **New in** `v0.27` 🔥: **Generate OpenAPI Documentation in vacuum**
139
+
140
+ A new `docs` command will generate the **best OpenAPI Documentation you ever saw**! Now vacuum has
141
+ integrated with [the printing press](https://github.com/pb33f/printing-press), it means
142
+ generating documentation with built-in linting results is available _right inside vacuum_.
143
+
144
+ Try it out! instead of the `lint` command try the `docs` command instead.
145
+
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/)
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/)
154
+
155
+ ---
156
+
157
+ `v0.25`: **Generate Open Collections from OpenAPI files**
128
158
 
129
159
  A new `open-collection` command will generate an [Open Collection](https://www.opencollection.com/) Workflow folder
130
160
  (or bundled file)
@@ -135,6 +165,7 @@ Open Collection is a new standard for defining and sharing API collections. vacu
135
165
 
136
166
  ---
137
167
 
168
+
138
169
  `v0.24`: **TURBO MODE**
139
170
 
140
171
  A huge tune up of hundreds of systems across the stack has resulted in significant speed boosts and improved memory performance.
@@ -161,7 +192,7 @@ Ever needed to tweak an OpenAPI spec for different environments without maintain
161
192
  Maybe swap out server URLs between dev, staging, and production? Or perhaps strip out internal endpoints before publishing the API docs?
162
193
 
163
194
  OpenAPI Overlays are the answer. They let us make non-destructive modifications to specs using JSONPath expressions to
164
- 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.
165
196
 
166
197
  - [Learn more about the apply-overlay command](https://quobix.com/vacuum/commands/apply-overlay)
167
198
 
@@ -235,9 +266,9 @@ New rules:
235
266
 
236
267
  ---
237
268
 
238
- `v0.17`: **Github Action**.
269
+ `v0.17`: **GitHub Action**.
239
270
 
240
- 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
241
272
  in the [GitHub Marketplace](https://github.com/marketplace/actions/vacuum-openapi-linter-and-quality-analysis-tool).
242
273
 
243
274
  ---
@@ -275,17 +306,25 @@ See all the documentation at https://quobix.com/vacuum
275
306
  - [Why should you care?](https://quobix.com/vacuum/why/)
276
307
  - [Concepts](https://quobix.com/vacuum/concepts/)
277
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/)
278
311
  - [CLI Commands](https://quobix.com/vacuum/commands/)
279
312
  - [lint](https://quobix.com/vacuum/commands/lint/)
280
313
  - [vacuum report](https://quobix.com/vacuum/commands/report/)
314
+ - [docs](https://quobix.com/vacuum/commands/docs/)
281
315
  - [dashboard](https://quobix.com/vacuum/commands/dashboard/)
282
316
  - [html-report](https://quobix.com/vacuum/commands/html-report/)
283
317
  - [bundle](https://quobix.com/vacuum/commands/bundle/)
284
318
  - [spectral-report](https://quobix.com/vacuum/commands/spectral-report/)
285
319
  - [language-server](https://quobix.com/vacuum/commands/language-server/)
320
+ - [upgrade](https://quobix.com/vacuum/commands/upgrade/)
286
321
  - [apply-overlay](https://quobix.com/vacuum/commands/apply-overlay/)
287
322
  - [Change Detection](https://quobix.com/vacuum/commands/change-detection/)
288
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/)
289
328
  - [Developer API](https://quobix.com/vacuum/api/getting-started/)
290
329
  - [Using The Index](https://quobix.com/vacuum/api/spec-index/)
291
330
  - [RuleResultSet](https://quobix.com/vacuum/api/rule-resultset/)
@@ -350,7 +389,7 @@ No external dependencies, the HTML report will run completely offline.
350
389
 
351
390
  ---
352
391
 
353
- > **_Supports OpenAPI Version 2 (Swagger) and Version 3+_**
392
+ > **_Supports OpenAPI Version 2, OpenAPI Version 3+, and JSON Schema documents_**
354
393
 
355
394
  You can use either **YAML** or **JSON**, vacuum supports both formats.
356
395
 
@@ -467,7 +506,7 @@ recognizes a compressed report file and will deal with it automatically when rea
467
506
 
468
507
  ## Ignoring specific linting errors
469
508
 
470
- 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`.
471
510
 
472
511
  ```
473
512
  ./vacuum lint --ignore-file <path-to-ignore-file.yaml> -d <your-openapi-spec.yaml>
@@ -477,8 +516,7 @@ You can ignore specific linting errors by providing an `--ignore-file` argument
477
516
  ./vacuum report --ignore-file <path-to-ignore-file.yaml> -c <your-openapi-spec.yaml> <report-prefix>
478
517
  ```
479
518
 
480
- The ignore-file should point to a .yaml file that contains a list of errors to be ignored by vacuum. The structure of the
481
- 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:
482
520
 
483
521
  ```
484
522
  <rule-id-1>:
@@ -511,7 +549,7 @@ if you're interested in seeing how things are progressing, it's available.
511
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),
512
550
  then you can use it with vacuum!
513
551
 
514
- 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.
515
553
 
516
554
  ### Here are some examples you can try
517
555
 
@@ -535,7 +573,7 @@ The `lint`, `dashboard` and `spectral-report` commands all accept a `-r` or `--r
535
573
  ./vacuum lint -r rulesets/examples/custom-ruleset.yaml <your-openapi-spec.yaml>
536
574
  ```
537
575
 
538
- **_All rules, all of them!**
576
+ **_All rules, all of them!_**
539
577
  ```
540
578
  ./vacuum lint -r rulesets/examples/all-ruleset.yaml <your-openapi-spec.yaml>
541
579
  ```
@@ -574,10 +612,10 @@ Use `--nested-refs-doc-context` or `motor.ExecutionOptions{NestedRefsDocContext:
574
612
  ### File
575
613
  You can configure vacuum using a configuration file named `vacuum.conf.yaml`
576
614
 
577
- By default, vacuum searches for this file in the following directories
615
+ By default, vacuum searches for this file in the following locations:
578
616
  1. Working directory
579
- 2. `$XDG_CONFIG_HOME`
580
- 3. `${HOME}/.config`
617
+ 2. `$XDG_CONFIG_HOME`, when set
618
+ 3. `${HOME}/.config`, when `$XDG_CONFIG_HOME` is not set
581
619
 
582
620
  You can also specify a path to a file using the `--config` flag
583
621
 
@@ -595,9 +633,9 @@ lint:
595
633
  ...
596
634
  ```
597
635
 
598
- ### Environmental variables
636
+ ### Environment variables
599
637
 
600
- 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>`
601
639
 
602
640
  If a flag, has a `-` in it, replace with `_`
603
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.26.8",
3
+ "version": "0.27.1",
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"