vacuum: Remote references in components/schemas fail to resolve
I have a openapi spec that works fine on https://editor.swagger.io/ that throws errors with vacuum.
Remote references in paths/.../schema seem fine, but not in components/references/whatever are not.
I can’t figure out how to modify the libopenapi tests in ways that don’t crash, so I dunno if the issue is with them or not.
The spec:
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "demo thing",
"description": "demo thing"
},
"paths": {
"/a": {
"get": {
"responses": {
"200": {
"description": "uses an external ref directly",
"content": {
"application/json": {
"schema": {
"$ref": "https://raw.githubusercontent.com/pb33f/libopenapi/main/test_specs/petstorev3.json#/components/schemas/Pet"
}
}
}
}
}
}
},
"/b": {
"get": {
"responses": {
"200": {
"description": "uses a thing in components/schemas",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SomeThing"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"SomeThing": {
"$ref": "https://raw.githubusercontent.com/pb33f/libopenapi/main/test_specs/burgershop.openapi.yaml#/components/requestBodies/BurgerRequest"
}
}
}
}
This results in the error:
cannot resolve reference https://raw.githubusercontent.com/pb33f/libopenapi/main/test_specs/burgershop.openapi.yaml#/components/requestBodies/BurgerRequest, it's missing: $https:.['raw.githubusercontent.com'].pb33f.libopenapi.main.test_specs['burgershop.openapi.yaml$'].components.requestBodies.BurgerRequest
If you switch the URLs it still only fails on the SomeThing ref.
I’m running with npx vacuum lint --base . -d $specFile, and I have vacuum version 0.3.13
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 15 (9 by maintainers)
This is a bug for sure. I will look into it ASAP. There is an overhaul of the indexing system in
libopenapihappening at the moment, which may automatically resolve this once upgraded.I will keep you posted.