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

Absolute and some relative paths broken in 10.0.1 #303

Closed
leeleahulkcs opened this issue Jan 24, 2023 · 6 comments
Closed

Absolute and some relative paths broken in 10.0.1 #303

leeleahulkcs opened this issue Jan 24, 2023 · 6 comments

Comments

@leeleahulkcs
Copy link

Version 9.1.0 = OK
Version 10.0.1 = BROKEN

This is broken on Windows only.

In our code, we call this module like this:

  • $RefParser.dereference(path.resolve('swagger/index.yaml'), ...

This worked in version 9.1.0. In version 10.0.1, it returns the error:

  • ResolverError: Error opening file "__path_to_root__\\node_modules\\@apidevtools\\json-schema-ref-parser\\__path_to_root__\\swagger\\index.yaml"

In file node_modules\@apidevtools\json-schema-ref-parser\cjs\util\projectDir.cjs:

  • projectDir is returned as __path_to_root__\\node_modules\\@apidevtools\\json-schema-ref-parser

So to get our code to work, we have to do one of two things:

  1. Change $RefParser.dereference(path.resolve('swagger/index.yaml'), ... to $RefParser.dereference('../../../swagger/index.yaml', ...
  2. In the file node_modules\@apidevtools\json-schema-ref-parser\cjs\util\projectDir.cjs, change const projectDir = nodePath.resolve(__dirname, "..", ".."); to const projectDir = nodePath.resolve(__dirname, "..", "..", "..", "..", "..");
@typhonrt
Copy link

I can confirm. v9.1.1 and 10.0.1 are affected on Windows; I just temporarily will stay on v9.0.9. Just want to say thanks to Phil for past efforts!

@KonkretneKosteczki
Copy link

I still experience the issue on windows for version @11.0.4

@FloErwerth
Copy link

We also experience this issue still on windows.

@NordengenT
Copy link

This is still not fixed and makes the library unusable on windows

@Bartel-C8
Copy link

Same on macOS here!

@jonluca
Copy link
Collaborator

jonluca commented Mar 6, 2024

I believe this is fixed by setting projectDir to cwd instead of referencing the file location itself - not sure why it was like that in the first place. Should be fixed in v11.2.3

@jonluca jonluca closed this as completed Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants