We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What version of Ajv are you using? Does the issue happen if you use the latest version?
ajv - 4.8.2
Ajv options object (see https://github.com/epoberezkin/ajv#options):
{ loadSchema: function(uri, callback) { request(uri, function(err, res, body) { if (err || res.statusCode >= 400) callback(err || new Error('Loading error: ' + res.statusCode)); else callback(null, JSON.parse(body)); }); } }
JSON Schema (please make it as small as possible to reproduce the issue):
{ "$schema": "http://json-schema.org/draft-04/hyper-schema#", "properties": { "links": { "type": "array", "items": { "$ref": "http://json-schema.org/draft-04/hyper-schema#/definitions/linkDescription" } } } }
Data (please make it as small as posssible to reproduce the issue):
{"links":[{"rel":"foo","href":"/foo"}]}
Your code (please use options, schema and data as variables):
options
schema
data
var request = require("request"); var Ajv = require('ajv'); var ajv = Ajv({ loadSchema: function(uri, callback) { request(uri, function(err, res, body) { if (err || res.statusCode >= 400) callback(err || new Error('Loading error: ' + res.statusCode)); else callback(null, JSON.parse(body)); }); } }); var schema = { "$schema": "http://json-schema.org/draft-04/hyper-schema#", "properties": { "links": { "type": "array", "items": { "$ref": "http://json-schema.org/draft-04/hyper-schema#/definitions/linkDescription" } } } }; ajv.compileAsync(schema, function(error, validate) { if (error) { console.log(error); } else { console.log('valid:', validate({"links":[{"rel":"foo","href":"/foo"}]})); }; });
https://runkit.com/lwhitaker/581b813da447b8001345f61f
I get this result:
Error: no schema with key or ref "http://json-schema.org/draft-04/hyper-schema#"
What results did you expect?
I expected the schema to be resolved.
Are you going to resolve the issue?
Sounds like you already have a fix for this coming in 5.0.
The text was updated successfully, but these errors were encountered:
@pressureDrop there is no fix yet, let me know if you want to make a PR to 5.0.0 branch.
Sorry, something went wrong.
test: failing test for #334, async loading of meta-schema
f95b83d
feat: async loading of meta-schema, #334
84b0531
TODO:
docs: compileAsync meta-schema support, closes #334
69f1e63
In 5.0.0-beta.0. To use: npm install ajv@^5.0.0-beta
npm install ajv@^5.0.0-beta
No branches or pull requests
What version of Ajv are you using? Does the issue happen if you use the latest version?
ajv - 4.8.2
Ajv options object (see https://github.com/epoberezkin/ajv#options):
JSON Schema (please make it as small as possible to reproduce the issue):
Data (please make it as small as posssible to reproduce the issue):
Your code (please use
options
,schema
anddata
as variables):https://runkit.com/lwhitaker/581b813da447b8001345f61f
I get this result:
What results did you expect?
I expected the schema to be resolved.
Are you going to resolve the issue?
Sounds like you already have a fix for this coming in 5.0.
The text was updated successfully, but these errors were encountered: