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

dereferencing ref of refs in the same path #21

Closed
educastellano opened this issue Jun 28, 2016 · 4 comments
Closed

dereferencing ref of refs in the same path #21

educastellano opened this issue Jun 28, 2016 · 4 comments

Comments

@educastellano
Copy link

I'm trying to dereference some schemas, but seems that it does not resolve the urls the way I need... I'm probably missing some option here.

I have all the schemas sitting on /schemas:
/schemas/a.json
/schemas/b.json
/schemas/c.json

So /schemas/a.json:

{
    "b": { "$ref": "b.json" }
}

dereferences well, but /schemas/b.json:

{
    "c": { "$ref": "c.json" }
}

is trying to find the schema under /schemas/b.json/:

  • GET https://localhost:8080/schemas/b.json/c.json/ 404 (Not Found)
  • Error downloading https://localhost:8080/schemas/b.json/c.json/
@JamesMessinger
Copy link
Member

JamesMessinger commented Jun 28, 2016

That's odd. Can you post a sample of how you're calling JSON Schema $Ref Parser? I suspect that it may be something wrong with the parameters or usage.

Also, are you running this in Node.js or in a web browser?

@educastellano
Copy link
Author

I'm just using it like this:

refParser.dereference('/schemas/a.json', (err, schema) => {
    if (err) {
        console.error(err)
    }
    else {
        console.log(schema)
    }
})

running in a web browser. I will do more testing tomorrow if you say it's supposed to work.

@JamesMessinger
Copy link
Member

Yeah, that should totally work. I do essentially that same thing all the time. And I have plenty of tests that cover that use-case as well. There's gotta be some difference we're missing here.

Can you try using the un-minified version of JSON Schema $Ref Parser and then stepping into the code to see what's going on?

@educastellano
Copy link
Author

I'm closing this since I had to move to something else. I was probably using it wrong...

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

2 participants