-
-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Follow-up to #798: Given this schema:
{
"openapi": "3.2.0",
"jsonSchemaDialect": "https://spec.openapis.org/oas/3.2/dialect/2025-09-17",
"info": {
"title": "Bundling example",
"description": "Bundling example",
"version": "0"
},
"servers": [
{"url": "https://example.com" }
],
"tags": [{ "name": "example" }],
"paths": {
"/widgets": {
"post": {
"tags": ["example"],
"description": "Lorem ipsum dolor sit amet.",
"operationId": "postWidget",
"requestBody": {
"description": "xxx",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/widget"
}
}
}
}
}
}
},
"components": {
"schemas": {
"_0_xxxx.schema.json": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/widget/widget.schema.json",
"title": "Widget",
"description": "Sed ut perspiciatis unde omnis.",
"type": "object"
},
"widget": {
"additionalProperties": false,
"description": "Nemo enim ipsam voluptatem.",
"properties": {
"body": {
"$ref": "https://example.com/widget/widget.schema.json"
}
},
"type": "object"
}
}
}
}When I run
vacuum lint -bad --no-clip -n warn openapi.jsonThe output is:
vacuuming file 'openapi.json' against 54 rules: https://quobix.com/vacuum/rulesets/recommended
ERR unable to fetch remote document
├── file: /widget/widget.schema.json
├── status: 404
└── resp: <!doctype html><html lang="en"><head><title>Example Domain</title><meta name="viewport" content="width=device-width, initial-scale=1"><style>body{background:#eee;width:60vw;margin:15vh auto;font-family:system-ui,sans-serif}h1{font-size:1.5em}div{opacity:0.8}a:link,a:visited{color:#348}</style></head><body><div><h1>Example Domain</h1><p>This domain is for use in documentation examples without needing permission. Avoid use in operations.</p><p><a href="https://iana.org/domains/example">Learn more</a></p></div></body></html>
ERR cannot locate file in the rolodex, check specification references and base path
└── file: https://example.com/widget/widget.schema.json
ERR unable to fetch remote document
├── file: /widget/widget.schema.json
├── status: 404
└── resp: <!doctype html><html lang="en"><head><title>Example Domain</title><meta name="viewport" content="width=device-width, initial-scale=1"><style>body{background:#eee;width:60vw;margin:15vh auto;font-family:system-ui,sans-serif}h1{font-size:1.5em}div{opacity:0.8}a:link,a:visited{color:#348}</style></head><body><div><h1>Example Domain</h1><p>This domain is for use in documentation examples without needing permission. Avoid use in operations.</p><p><a href="https://iana.org/domains/example">Learn more</a></p></div></body></html>
ERR cannot locate file in the rolodex, check specification references and base path
└── file: https://example.com/widget/widget.schema.json
> openapi.json
----------------------------------------------------------------------------------
openapi.json:22:33 ▲ warning
├─ media type is missing `examples` or `example`
├─ Rule: oas3-missing-example | Category: Examples
└─ Path: $.paths['/widgets'].post.requestBody.content['application/json']
openapi.json:34:7 ▲ warning
├─ schema is missing `examples` or `example`
├─ Rule: oas3-missing-example | Category: Examples
└─ Path: $.components.schemas['_0_xxxx.schema.json']
openapi.json:34:30 ▲ warning
├─ `#/components/schemas/_0_xxxx.schema.json` is potentially unused or has been orphaned
├─ Rule: oas3-unused-component | Category: Schemas
└─ Path: $.components.schemas['_0_xxxx.schema.json']
openapi.json:45:11 ▲ warning
├─ media type schema property `body` is missing `examples` or `example`
├─ Rule: oas3-missing-example | Category: Examples
└─ Path: $.components.schemas['_0_xxxx.schema.json']
category ✗ errors ▲ warnings ● info
─────────────── ───────── ───────── ────────────────────────────────────────────────────────
Schemas 0 1 0
Examples 0 3 0
─────────────── ───────── ───────── ────────────────────────────────────────────────────────
total 0 4 0
rule violations quality impact
───────────────────────── ────────── ──────────────────────────────
oas3-missing-example 3 ██████████████████████████████
oas3-unused-component 1 ██████████
───────────────────────── ────────── ──────────────────────────────
total 4
--> use the <dashboard> command to be able to navigate results interactively <--
┌─────────────────────────────────────────────────────────────────────────────────┐
│ │
│ Quality Score: 98/100 [A+] │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
│
│ ▲ Passed, but with 4 warnings and 0 informs.
│
use --debug if you want to enable developer logging
Issue 1
It appears that vacuum tries to download https://example.com/harpo/eg/widget/widget.schema.json even though it's already defined as an $id at line 45. I don't think it should do that, it should already be in the rolodex, no?
Issue 2
Secondly, this warning seems unnecessary:
openapi.json:34:30 ▲ warning
├─ `#/components/schemas/_0_xxxx.schema.json` is potentially unused or has been orphaned
├─ Rule: oas3-unused-component | Category: Schemas
└─ Path: $.components.schemas['_0_xxxx.schema.json']
While it's true that _0_xxxx.schema.json is never referenced, its $id on line 36 is referenced by the component below on line 46. I don't think this warning should happen.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels