Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@stoplight/path: Cannot parse <openapi.yaml> because it is not a string #2567

Open
philsturgeon opened this issue Dec 27, 2023 · 0 comments
Open
Labels
p/medium t/bug Something isn't working

Comments

@philsturgeon
Copy link
Contributor

Describe the bug

I'm getting a strange error from @stoplight/path about not being able to parse a file which is perfectly parseable by other similar tools. Vacuum lints it. Swagger Editor doesnt find an error loads it.

$ spectral lint https://opencagedata.com/opencage-openapi-3.0.0.yaml
Error: Could not parse https://opencagedata.com/opencage-openapi-3.0.0.yaml: @stoplight/path: Cannot parse https://opencagedata.com/opencage-openapi-3.0.0.yaml because it is not a string
    at Object.<anonymous> (/snapshot/spectral/dist/fs/reader.js:68:19)
    at Generator.throw (<anonymous>)
    at rejected (/snapshot/spectral/node_modules/tslib/tslib.js:108:69)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
    at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:59:3)
    at Function.Module.runMain (pkg/prelude/bootstrap.js:1317:13)
    at internal/main/run_main_module.js:17:11

Happens when loading via URL or downloading and loading via filesystem.

To Reproduce

  1. Given this OpenAPI: https://opencagedata.com/opencage-openapi-3.0.0.yaml
  2. Run this CLI command spectral lint ...
  3. See error

Expected behavior

Vacuum gives me all the usual expected errors:

/Users/phil/src/opencage-openapi-3.0.0.yaml
-------------------------------------------
Location                           | Severity | Message                                                                            | Rule                      | Category   | Path
opencage-openapi-3.0.0.yaml:27:7   | error    | the 'get' operation at path '/v{version}/{format}' does not contain an operationId | operation-operationId     | Operations | $.paths./v{version}/{format}.get
opencage-openapi-3.0.0.yaml:36:13  | warning  | Schema for `version` does not contain any examples or example data                 | oas3-valid-schema-example | Examples   | $.paths./v{version}/{format}.get.parameters[0]
opencage-openapi-3.0.0.yaml:43:13  | warning  | Schema for `format` does not contain any examples or example data                  | oas3-valid-schema-example | Examples   | $.paths./v{version}/{format}.get.parameters[1]
opencage-openapi-3.0.0.yaml:50:13  | warning  | Schema for `q` does not contain any examples or example data                       | oas3-valid-schema-example | Examples   | $.paths./v{version}/{format}.get.parameters[2]
opencage-openapi-3.0.0.yaml:56:13  | warning  | Schema for `key` does not contain any examples or example data                     | oas3-valid-schema-example | Examples   | $.paths./v{version}/{format}.get.parameters[3]

Spectral should do the same.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (remove any that are not applicable):

  • Library version: whatever npm install -g @stoplight/spectral-cli does December 27th 2023.

Additional context

$ which spectral
/usr/local/bin/spectral

Weirdly spectral --version gives 0.0.0.

@mnaumanali94 mnaumanali94 added t/bug Something isn't working p/medium labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/medium t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants