-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
internal reference in schema #19
Comments
hmmm... Maybe there's just a typo or something? It runs fine for me. Try it out here |
May i know which version of json-schema-ref-parser are you using here ? |
The code sample I posted is using the latest released version (3.1.2), but it would also work with any previous version. For example, here it is working with version 1.0.0 |
I think I'm having a similar issue. Here's my main swagger.yaml: swagger.yaml
which references paths.yaml: paths.yaml
and when I try to bundle them: bundler.js
Result:
|
Happy New Year @BigstickCarpet! I'm wondering if you've had the opportunity to check this out? No problem if not, I know its a busy time :) |
Hi, @dave-irvine. Sorry, I somehow missed your comment from two weeks ago; otherwise, I would have responded sooner. The behavior you're seeing is by design and per the JSON Pointer spec. JSON pointers are relative to the root of the document they're in. So, in |
Aha! Thanks very much :) |
@BigstickCarpet I just ported my code to using your library for validation and bundle. I experienced the same problem as @dave-irvine . I am sure I used I am no pro regarding swagger but it is great to have the freedom to use this kind of internal definition references in subfolder files that do not have these itself. What do you say? Is there a better way? An option like Any way. Great library. Happy Swaggering. 💃 |
Hi @BigstickCarpet again. An optional error handler would be a nice solution. |
This is a problem code
Need a PR adds option to skip this type references resolution (starting exactly with |
As far as I can tell, everything is behaving as expected and according to the spec. Perhaps I don't understand something. Can somebody please provide a reproduction of the issue, preferably on RunKit? Here are reproductions of other issues, as examples: https://runkit.com/bigstickcarpet/json-schema-ref-parser-issue-93 |
I am trying to dereference resolved schema object. But it is throwing error as "Error resolving $ref pointer "#/definitions/ApiCallList". Token "definitions" does not exist."
Is this a bug or What is the correct way to define $ref to refer internal definition within the schema object.
$RefParser = require('json-schema-ref-parser') $RefParser.dereference(schema, { $refs: { circular: "ignore" } }) .then(function(resolvedSchema) { res.send(resolvedSchema); })
Sample Schema
{ "definitions":{ "ApiCallList":{ "description":"A list of Api Call Resources", "id":"ApiCallList" }, "MaskCallList":{ "description":"A list of Mask Call Resources", "id":"MaskCallList" } }, "resources":{ "api-call":{ "methods":{ "request":{ "$ref":"#/definitions/ApiCallList }, "response":{ "$ref":"#/definitions/MaskCallList } } } } }
The text was updated successfully, but these errors were encountered: