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

Path issues on Windows #679

Closed
nulltoken opened this issue Oct 13, 2019 · 0 comments · Fixed by #740
Closed

Path issues on Windows #679

nulltoken opened this issue Oct 13, 2019 · 0 comments · Fixed by #740
Assignees
Labels
t/bug Something isn't working

Comments

@nulltoken
Copy link
Contributor

nulltoken commented Oct 13, 2019

Describe the bug

Spectral doesn't seem to cope well with backslashes in paths on Windows.

To Reproduce

  1. Given this OpenAPI document '...'

lib.yaml

openapi: 3.0.0

paths: 17

components:
  schema:
    Test:
      type: number
  1. Run this CLI command '....'

Powershell (Take 1)

PS C:> yarn spectral lint .\repro\lib.yaml
No results with a severity of 'hint' or higher found!

Done in 1.52s.

Bash

$ C:\node_modules\.bin\spectral lint ./repro/lib.yaml
OpenAPI 3.x detected

c:/repro/lib.yaml
 1:1  warning  api-servers       OpenAPI `servers` must be present and non-empty array.
 1:1    error  oas3-schema       should have required property 'info'
 1:1  warning  info-contact      Info object should contain `contact` object.
 1:1  warning  info-description  OpenAPI object info `description` must be present and non-empty string.

✖ 4 problems (1 error, 3 warnings, 0 infos, 0 hints)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Powershell (Take 2 typing the full path, using forward slashes and fighting to not rely on shell auto completion (which would revert every slashes to backward ones) )

PS C:\> yarn spectral lint ./repro/lib.yaml
yarn run v1.15.2
$ C:\node_modules\.bin\spectral lint ./repro/lib.yaml
OpenAPI 3.x detected

c:/repro/lib.yaml
 1:1  warning  api-servers       OpenAPI `servers` must be present and non-empty array.
 1:1    error  oas3-schema       should have required property 'info'
 1:1  warning  info-contact      Info object should contain `contact` object.
 1:1  warning  info-description  OpenAPI object info `description` must be present and non-empty
string.

✖ 4 problems (1 error, 3 warnings, 0 infos, 0 hints)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior
Current default Spectral user experience for a guy working on a Windows computer is pretty poor (not everyone use bash as his/her default shell on Windows).

Spectral should properly parse paths, even the ones that look weird to a *nix user 😉

Although the issue is shown with Powershell, standard Windows cmd also exposes the same behavior.

Environment (remove any that are not applicable):

  • Library version: 4.2.0
  • OS: Windows 7
@nulltoken nulltoken added the t/bug Something isn't working label Oct 13, 2019
@P0lip P0lip self-assigned this Nov 6, 2019
@P0lip P0lip mentioned this issue Nov 6, 2019
4 tasks
@P0lip P0lip closed this as completed in #740 Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants