diff --git a/.gitignore b/.gitignore index ebfa2ca..9aa7af3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ schema/ +full-schema/ dist/ gh-pages/ /examples/*.json diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 93254a1..bad546a 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -1,4 +1,5 @@ path = require 'path' +deref = require 'json-schema-deref-sync' module.exports = -> # Project configuration @@ -105,12 +106,27 @@ module.exports = -> @file.write filename, JSON.stringify d._data, null, 2 @log.writeln "Created example file '#{filename}'" + # Custom task for generating full JSON schemas by dereferencing original schemas + @registerTask 'build_fullschemas', 'Create full schemas dereferencing them', => + options = + baseFolder: 'schema' + @file.mkdir 'full-schema' + schemas = @file.expand ['schema/*.json'] + schemas.forEach (e) => + schema = @file.readJSON e + fullschema = deref schema, options + basename = path.basename e + filename = "full-schema/#{basename}" + @file.write filename, JSON.stringify fullschema, null, 2 + @log.writeln "Created full schema #{filename}" + # Our local tasks @registerTask 'build', 'Build', (target = 'all') => @task.run 'yaml' @file.mkdir 'dist' @task.run 'copy' @task.run 'build_examples' + @task.run 'build_fullschemas' @task.run 'aglio' @registerTask 'test', 'Build and run tests', (target = 'all') => diff --git a/blueprint/api.apib b/blueprint/api.apib index a8ee2ca..113ee69 100644 --- a/blueprint/api.apib +++ b/blueprint/api.apib @@ -68,7 +68,7 @@ Performing such an action returns a Location header with a Job URL. + Schema ``` - + ``` + Response 201 @@ -97,7 +97,7 @@ Performing such an action returns a Location header with a Job URL. + Schema ``` - + ``` ### Update website details [PUT] @@ -113,7 +113,7 @@ Performing such an action returns a Location header with a Job URL. + Schema ``` - + ``` + Response 200 (application/json) @@ -121,7 +121,7 @@ Performing such an action returns a Location header with a Job URL. + Schema ``` - + ``` ### Delete website [DELETE] @@ -187,7 +187,7 @@ Note that publishing an item to a website is a separate step. See /publish + Schema ``` - + ``` @@ -269,7 +269,7 @@ When an item is being worked on by a user it is available via the API. Queries w + Schema ``` - + ``` + Response 404 @@ -281,7 +281,7 @@ When an item is being worked on by a user it is available via the API. Queries w + Schema ``` - + ``` + Response 422 @@ -321,7 +321,7 @@ TODO: make return a Job id in Location header + Schema ``` - + ``` + Response 202 @@ -343,7 +343,7 @@ TODO: make return a Job id in Location header + Schema ``` - + ``` + Response 202 diff --git a/blueprint/passport.apib b/blueprint/passport.apib index 8b4217b..acb123b 100644 --- a/blueprint/passport.apib +++ b/blueprint/passport.apib @@ -21,7 +21,7 @@ The Grid Passport is The Grid's account system that is responsible for access co + Schema ``` - + ``` ### Update user information [PUT] @@ -61,7 +61,7 @@ Update the current user's profile information, for example to add missing detail + Schema ``` - + ``` ## User's public GitHub Token [/api/user/github] diff --git a/package.json b/package.json index 31ebefb..a3807ca 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "grunt-mocha-test": "^0.12.7", "grunt-yaml": "^0.4.1", "grunt-yamllint": "^0.2.0", + "json-schema-deref-sync": "^0.3.0", "mocha": "^2.1.0", "tv4": "^1.1.9" },