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
Hi there,
I get a
Fatal error: Cannot call method 'replace' of undefined
error when trying to validate a schema that references another schema file. Stacktrace is
C:\tmp\api>grunt --stack Running "tv4:todo" (tv4) task > pass | apidef/todo_example.json >> tv4 validated 1 of 1 value Running "tv4:todos" (tv4) task > load + todo.json Fatal error: Cannot call method 'replace' of undefined TypeError: Cannot call method 'replace' of undefined at C:\tmp\api\node_modules\grunt-tv4\lib\loader.js:28:13 at fs.js:207:20 at Object.oncomplete (fs.js:107:15)
This only occurs when the .json files are in a different folder from my Gruntfile
My Gruntfile is as follows:
Gruntfile
var formats = require('tv4-formats'); module.exports = function(grunt) { grunt.loadNpmTasks('grunt-tv4'); grunt.initConfig({ tv4:{ todo:{ options: { root:grunt.file.readJSON('apidef/todo.json'), formats:formats, }, src: ['apidef/todo_example.json'] }, todos:{ options: { root:grunt.file.readJSON('apidef/todos.json'), formats:formats, }, src: ['apidef/todos_example.json'] }, } }); grunt.registerTask('default', ['tv4']); };
and my todos.json file is as follows:
todos.json
{ "id":"todos", "type":"array", "$schema": "http://json-schema.org/draft-04/schema#", "items": { "$ref": "todo.json"} }
Any ideas what I'm doing wrong?
The text was updated successfully, but these errors were encountered:
I don't see anything glaringly wrong in your config.
When I check the code at that stack-trace (https://github.com/Bartvds/grunt-tv4/blob/master/lib/loader.js#L28) then I think for some odd reason the loader has some bug and passes undefined instead of the file contents.
undefined
I'm at the office right now, so I'll have to look into it when I'm back from work.
Sorry, something went wrong.
The full set of code can be found here https://github.com/rabidgremlin/RAML-Experiments On 28 Oct 2014 23:29, "Bart van der Schoor" notifications@github.com wrote:
I don't see anything glaringly wrong in your config. When I check the code at that stack-trace ( https://github.com/Bartvds/grunt-tv4/blob/master/lib/loader.js#L28) then I think for some odd reason the loader has some bug and passes undefined instead of the file contents. I'm at the office right now, so I'll have to look into it when I'm back from work. — Reply to this email directly or view it on GitHub #14 (comment).
When I check the code at that stack-trace ( https://github.com/Bartvds/grunt-tv4/blob/master/lib/loader.js#L28) then I think for some odd reason the loader has some bug and passes undefined instead of the file contents.
— Reply to this email directly or view it on GitHub #14 (comment).
No branches or pull requests
Hi there,
I get a
Fatal error: Cannot call method 'replace' of undefined
error when trying to validate a schema that references another schema file. Stacktrace is
This only occurs when the .json files are in a different folder from my Gruntfile
My
Gruntfile
is as follows:and my
todos.json
file is as follows:Any ideas what I'm doing wrong?
The text was updated successfully, but these errors were encountered: