Relative $refs aren't relative to the file in which they are declared.
See original GitHub issueDescription
Relative $ref
declarations don’t resolve relative to their containing file.
For example
main.yaml
- models
- model1.yaml
- common
- shared.yaml
Assume a reference in model1.yaml
like $ref: '../common/shared.yaml#/definitions/MyObj'
This will fail via an Unable to load RELATIVE ref: ...
error (via the codegen).
The ResolverCache
resolves these references relative to a parentDirectory
file that is final:
Wouldn’t the parentDirectory
need to be variable - i.e., be set to the directory containing the file where the $ref is declared?
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
typescript can't resolve non-relative path in import
I 'm fairly certain (based on the solution that worked for me) that TypeScript treats it as an absolute path from the 'compilerOptions.baseUrl'...
Read more >Using Relative URIs
What the Relative URI Pattern gives you then, is the ability for you system to work with different base addresses without being modified....
Read more >FDOT 'Save Relative Path' for references and any changes ...
My understanding is both usages of 'relative path' are not referring to 'save ... Relative Path is the only way to see the...
Read more >Using relative paths for Windows shortcuts - Super User
You can use this utility: Relative. It basically creates a shortcut to "explorer.exe" with the parameter of your relative path with a right...
Read more >Documentation - Module Resolution - TypeScript
A relative import is resolved relative to the importing file and cannot resolve to an ambient module declaration. You should use relative imports...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m experiencing this same issue with version 2.3.1, but neitherupgrading the swagger parser to 1.0.34 nor 1.0.35-SNAPSHOT fixes it for me, however 1.0.44 does! Sorry to necro this, but might be useful to others
I could use 1.0.34 to parse a graph of mutually referencing models successfully Kevin took it one step further with the code generation, but had to use 1.0.35-SNAPSHOT
We did not have the time to isolate which commit(s) did fix the problem
Thanks for your assistance!
On Mon, Apr 16, 2018 at 2:43 PM, Kevin Peterson notifications@github.com wrote: