Skip to content

Absolute and some relative paths broken in 10.0.1 #303

@leeleahulkcs

Description

@leeleahulkcs

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, "..", "..", "..", "..", "..");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions