vacuum icon indicating copy to clipboard operation
vacuum copied to clipboard

Issues resolving OpenAPI references

Open LukeHagar opened this issue 10 months ago • 12 comments

Here is the error in VSCode: image

Here is the path in the file referenced: image

Additionally the web docs path for the vacuum linting error sends me here: https://quobix.com/vacuum/rules/schemas/resolving-references/

But this link goes right to a 404

LukeHagar avatar Apr 19 '24 17:04 LukeHagar

This failure is happening because of the x- prefix, it looks like an extension, so it's not indexed, which means it cannot be looked up.

And the 404, yeah I know about that one - thanks for the nudge. I will address it.

daveshanley avatar Apr 19 '24 17:04 daveshanley

If you look here: https://spec.openapis.org/oas/v3.1.0#header-object

You can see that Header objects can be extended with extensions, which means anything with x- as a prefix is considered an extension and is excluded .

daveshanley avatar Apr 19 '24 18:04 daveshanley

Should that still be parsed that way when its at the name level of the object and not a property?

LukeHagar avatar Apr 19 '24 20:04 LukeHagar

Also if its exclusively the x- that is the problem, how about these references? image

image

LukeHagar avatar Apr 19 '24 21:04 LukeHagar

image

LukeHagar avatar Apr 19 '24 21:04 LukeHagar

Have you configured vacuum when using the VSCode plugin? And set a base path?

daveshanley avatar Apr 19 '24 22:04 daveshanley

Wouldn’t the base path be the pwd of the current document?

On Fri, Apr 19, 2024 at 5:33 PM quobix @.***> wrote:

Have you configured vacuum when using the VSCode plugin? And set a base path?

— Reply to this email directly, view it on GitHub https://github.com/daveshanley/vacuum/issues/488#issuecomment-2067357687, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLQECS2R34G3F7BZD3ZBDTY6GLSBAVCNFSM6AAAAABGPSL6JCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXGM2TONRYG4 . You are receiving this because you authored the thread.Message ID: @.***>

LukeHagar avatar Apr 19 '24 23:04 LukeHagar

Well, not out of the gate, it's why there is a --base / -p flag to tell vacuum where to look as people tend to scatter things all over the place.

Check out the configuration options and set a base path. Let me know how that works, and then perhaps we can look at tuning the VScode plugin to try and set it automatically.

daveshanley avatar Apr 20 '24 13:04 daveshanley

Just a note that adding a vacuum.conf.yaml with a base of "." does not resolve this issue.

LukeHagar avatar Apr 23 '24 14:04 LukeHagar

does it work when you use vaccum outside of VSCode just as a CLI tool?

daveshanley avatar Apr 23 '24 15:04 daveshanley

It seems to be, or at least its not providing the same errors.

It's now saying the below for most of these $refs

 a `$ref` cannot be placed next to any other properties 

But this seems to go against the documentation for $refs being able to include a description. https://www.speakeasyapi.dev/openapi/references

LukeHagar avatar Apr 23 '24 18:04 LukeHagar

I recognize these latest errors are also mentioned here: #484

LukeHagar avatar Apr 23 '24 20:04 LukeHagar