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

"no schema" Error thrown #509

Closed
jabberwo opened this issue Jun 5, 2017 · 7 comments
Closed

"no schema" Error thrown #509

jabberwo opened this issue Jun 5, 2017 · 7 comments

Comments

@jabberwo
Copy link

jabberwo commented Jun 5, 2017

Hi,

First time user of AJV. I'm trying to use extract-text-webpack-plugin that depends on AJV. While this plugin is doing its thing during bundling my CSS output via webpack; AJV throws the error message:

Error: no schema with key or ref "http://json-schema.org/draft-04/schema#"

Can't understand what its complaint is. That URL will load a JSON file so its valid. I don't like the idea that my deployment is now dependent on an external URL! Is there a way to turn off what ever its doing at this point; or use a local schema?

thanks
Jab

PS
The full error stack is:

 [exec]     if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
 [exec]             ^
 [exec]
 [exec] Error: no schema with key or ref "http://json-schema.org/draft-04/schema#"
 [exec]     at Ajv.validate (<my home directory>/node_modules/ajv/lib/ajv.js:94:19)
 [exec]     at Ajv.validateSchema (<my home directory>/node_modules/ajv/lib/ajv.js:178:22)
 [exec]     at Ajv._addSchema (<my home directory>/node_modules/ajv/lib/ajv.js:310:10)
 [exec]     at Ajv.validate (<my home directory>/node_modules/ajv/lib/ajv.js:96:26)
 [exec]     at validate (<my home directory>/node_modules/extract-text-webpack-plugin/schema/validator.js:8:20)
 [exec]     at Function.ExtractTextPlugin.extract (<my home directory>/node_modules/extract-text-webpack-plugin/index.js:204:3)
 [exec]     at Object.<anonymous> (<my build directory>/webpack-helper.k4LeH754/webpack.config.js:40:33)
 [exec]     at Module._compile (module.js:570:32)
 [exec]     at Object.Module._extensions..js (module.js:579:10)
 [exec]     at Module.load (module.js:487:32)
@epoberezkin
Copy link
Member

see #472

@epoberezkin
Copy link
Member

Added note to readme: daf7d6b

@joshuguessennd
Copy link

hi it's my first time using json schema and i get this issue
Uncaught Error: no schema with key or ref "http://json-schema.org/draft-04/schema#"
at Ajv.validate (ajv.js:95)
at Ajv.validateSchema (ajv.js:183)
at Ajv._addSchema (ajv.js:317)
at Ajv.validate (ajv.js:97)
at validateFormData (validate.js:196)
at Form.validate (Form.js:166)
at Form.js:87
at Form._this.onSubmit (Form.js:103)
at HTMLUnknownElement.boundFunc (ReactErrorUtils.js:63)
at Object.ReactErrorUtils.invokeGuardedCallback (ReactErrorUtils.js:69)

@silouanwright
Copy link

Same. I'm trying to figure this out.

@silouanwright
Copy link

Be careful that the version of ajv you're using, matches the schema json file you use. That will also trigger this error.

@jorotenev
Copy link

jorotenev commented Feb 11, 2018

I think the referenced instructions don't work for 6.x. With the same code and 5.5.2 I can successfully add a meta schema, with 6.x - I get a no schema with key or ref.
@epoberezkin

edit: oops, didn't notice the var ajv = new Ajv({schemaId: 'id'}); on top of the README.

@epoberezkin
Copy link
Member

epoberezkin commented Feb 11, 2018

@jorotenev Difficult to say what's the problem without the example, but it all works. You should add all meta-schemas to the instance that are used in your schemas in "$schema" keyword. By default in v6 only draft-07 meta-schema is added, in v5 - only draft-06.

EDIT: So, if you use draft-06 schema in v5 it will just work, in v6 you either have to update $schema to be draft-07 (it's backward compatible, so it's ok), or add draft-06 meta-schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants