Skip to content

Unable to run vacuum on a directory containing - OR $ref containing ../ causes issues #626

@paragon

Description

@paragon

Hi there,

I have a directory structured as follows:

openapi/
├─ api-suite/
│  ├─ components/
│  │  ├─ parameters/
│  │  │  ├─ example_param.yaml
│  ├─ paths/
│  │  ├─ hello_world.yaml
│  ├─ openapi.yaml

My API is quite large, so I utilize the $ref syntax quite heavily, especially when referring to files in other directories. For example, within hello_world.yaml, under parameters, I have an entry for - $ref: ../components/parameters/example_param.yaml.

However, I observe the following behavior when I run the following commands:

~/openapi/api-suite
> vacuum dashboard openapi.yaml

...yields:

ERROR unable to open the rolodex file, check specification references and base path
    └ file: ../components/parameters/example_param.yaml
    └ error: open /Users/m/openapi/components/parameters/example_param.yaml
ERROR unable to locate reference anywhere in the rolodex reference: ../components/parameters/example_param.yaml

If I try running vacuum at the parent directory level (~/openapi) with the following command, api-suite is also not being utilized.

~/openapi
> vacuum dashboard api-suite/openapi.yaml --base="api-suite"

...yields the same error:

ERROR unable to open the rolodex file, check specification references and base path
    └ file: ../components/parameters/example_param.yaml
    └ error: open /Users/m/openapi/components/parameters/example_param.yaml
ERROR unable to locate reference anywhere in the rolodex reference: ../components/parameters/example_param.yaml

It appears like one of two things is happening:

  1. For some reason, naming my directory api-suite is causing issues and not being respected.
  2. Since I use ../, it is being applied in the PWD (i.e. at ~/openapi/partner-api or ~/openapi), instead of at the level of the directory where the file exists.

Thank you for taking a look!

More importantly, thanks for making an awesome open-source project! I'm looking forward to seeing what issues it uncovers on my OpenAPI spec 😄

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions