@quobix/vacuum 0.26.4 → 0.26.5
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 +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -542,6 +542,33 @@ The `lint`, `dashboard` and `spectral-report` commands all accept a `-r` or `--r
|
|
|
542
542
|
|
|
543
543
|
---
|
|
544
544
|
|
|
545
|
+
## Reference resolution in rules
|
|
546
|
+
|
|
547
|
+
vacuum has two resolved-execution controls:
|
|
548
|
+
|
|
549
|
+
- Per rule: `resolved`
|
|
550
|
+
- Per run: `--resolve-all-refs` or `motor.ExecutionOptions{ResolveAllRefs: true}`
|
|
551
|
+
|
|
552
|
+
In YAML/JSON rulesets, `resolved` defaults to `true`. In that mode, `given`, matched nodes, `Index`, and `SpecInfo` come from the dereferenced document, but `context.Document` stays unresolved for compatibility.
|
|
553
|
+
|
|
554
|
+
Set `resolved: false` when a rule needs the raw document, for example to inspect `$ref` directly. If you build `model.Rule` values in Go, set `Resolved` explicitly.
|
|
555
|
+
|
|
556
|
+
```yaml
|
|
557
|
+
rules:
|
|
558
|
+
response-has-content:
|
|
559
|
+
given: "$.paths[*][*].responses['404']"
|
|
560
|
+
resolved: false
|
|
561
|
+
then:
|
|
562
|
+
field: content
|
|
563
|
+
function: defined
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
`--resolve-all-refs` forces every rule into resolved execution, overrides `resolved: false`, and also supplies resolved `context.Document` to rule functions.
|
|
567
|
+
|
|
568
|
+
Use `--nested-refs-doc-context` or `motor.ExecutionOptions{NestedRefsDocContext: true}` for split specs where an external file contains another relative `$ref`. That makes nested relative refs resolve from the referenced document instead of the root document. It only affects resolved execution, including runs forced by `--resolve-all-refs`.
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
545
572
|
## Configuration
|
|
546
573
|
|
|
547
574
|
### File
|