How to see current path inside resolver?
How can I make a custom resolver for relative paths?
How do I see the path from which the $ref originates?
Unfortunately, there's not currently a way to determine the source of the $ref inside a resolver. It only gives you the $ref itself. It would be a good idea to add though. I'd gladly accept a PR for it too.
I'm on it. Should be on the file object, right, not as another param?
This way it's a non-breaking change too.
Yup. That's what I was thinking as well. Thanks for helping out! 🥇 💯
@qm3ster - have you made any progress on this? I was thinking of tackling it this weekend as I need it too.
Any hints on which file(s) to look at - that would speed things up for me if you already know that.
@ziadsawalha no, sorry. I started, but I don't think I have that branch any more.
This is where the file object is created - https://github.com/APIDevTools/json-schema-ref-parser/blob/master/lib/parse.js#L29
Thanks @qm3ster. After digging into this a little it turns out the behavior I was looking for was already implemented correctly.
My issue turned out to be a bug in https://github.com/maxdome/swagger-combine where it resolved files in relation to cwd and not the file itself.
Implemented in #124.