-
-
Notifications
You must be signed in to change notification settings - Fork 233
Inline dereferencing and fragments #17
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
Comments
Currently, JSON Schema $Ref Parser only supports canonical dereferencing, as required by the JSON Schema spec. Support for inline dereferencing is optional, and I haven't found much real-world demand for it, so it's not currently supported. That said, if there's lots of demand for it, then I may add it in the future. I'd also welcome a pull-request, if you feel like tackling this yourself. As long as it doesn't break compatibility with any of the current canonical dereferencing functionality, I'd gladly accept it. If you decide to give this a go, please fork the 4.0.0 branch, not the current 3.x branch. |
Internal reference support is a should, however
The program crashes with an error on valid schemas because of lack of adherence to this clause. If it's not going to support internal references, it should ignore them. |
I intend to support inline references in the next version of JSON Schema $Ref Parser, which I have already begun working on. 👍 |
@BigstickCarpet Are you still open to pull requests on this, or is it far enough that I can test it? I really need internal dereferencing. |
Hi @TJKoury - I haven't had time to make any progress on this, but I'd be glad to accept a PR (especially if it also includes tests) 😉 |
@BigstickCarpet Thanks for the quick reply! What branch should I work off of, were I to attempt this task? Also, I can't seem to get the tests to run without also install puppeteer, keep getting Update: I can't get it to run even with puppeteer. What OS / version do you have this working on? |
@TJKoury - Now that v4 has been released, you can just work off of the |
... so this means this issue is likely resolved and can be closed? |
json-schema-ref-parser appears to not support a portion of the JSON Schema spec regarding inline dereferencing (see http://json-schema.org/latest/json-schema-core.html#anchor31)
Reproducer:
`
var test = {
"id": "http://some.site/schema#",
"not": { "$ref": "#inner" },
"definitions": {
"schema1": {
"id": "#inner",
"type": "boolean"
}
}
};
deref.dereference(test, function(err, schema){
console.log(err, schema);
});
`
Output:
"name": "SyntaxError", "message": "Invalid $ref pointer \"inner\". Pointers must begin with \"#/\"", "stack": "SyntaxError: Invalid $ref pointer \"inner\". Pointers must begin wit h \"#/\"
I understand that this is not a required part of the spec, however it is a SHOULD given that the implementation does support inline dereferencing in general.
The text was updated successfully, but these errors were encountered: