From cfc0fbabfa5ae8bba51a250729aa3564bfbd8e6a Mon Sep 17 00:00:00 2001 From: Vilson Vieira Date: Mon, 18 Apr 2016 22:40:08 -0300 Subject: [PATCH 1/4] Require JSON schema deref lib --- package.json | 1 + 1 file changed, 1 insertion(+) 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" }, From 51890e1eb4655a3fe25cac1565c070e8cfabab1d Mon Sep 17 00:00:00 2001 From: Vilson Vieira Date: Mon, 18 Apr 2016 22:40:35 -0300 Subject: [PATCH 2/4] Create Grunt task to deref JSON schemas Full JSON schemas are saved on `full-schema` and can be included in Blueprints --- Gruntfile.coffee | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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') => From 44be702cb1680f580ebb2d406854b07f9f28124d Mon Sep 17 00:00:00 2001 From: Vilson Vieira Date: Mon, 18 Apr 2016 22:41:59 -0300 Subject: [PATCH 3/4] Ignore full-schema dir --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 From ab0bb426ebd3a0b12d453a7b3192e25e1344ae79 Mon Sep 17 00:00:00 2001 From: Vilson Vieira Date: Mon, 18 Apr 2016 22:42:20 -0300 Subject: [PATCH 4/4] Include full schemas instead of ones --- blueprint/api.apib | 18 +++++++++--------- blueprint/passport.apib | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) 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]