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

Json schema #219

Merged
merged 2 commits into from
Nov 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
token.json
npm-debug.log
test/.tmp/**
yarn-error.log
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪 💪 💪

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"devDependencies": {
"babel-eslint": "^6.1.2",
"chai": "^3.5.0",
"chai-json-schema": "^1.5.0",
"eslint": "^3.14.0",
"eslint-config-airbnb-base": "^11.0.1",
"eslint-plugin-import": "^2.2.0",
Expand Down
39 changes: 39 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {},
"type": "array",
"additionalItems": false,
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"author": {
"type": "string"
},
"url": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"packs": {
"type": "array",
"items": {
"type": "string"
}
},
"stars":{
"type": "number"
}
}
}
}
11 changes: 10 additions & 1 deletion test/test.utils_writePlugins.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { assert } = require('chai');
const chai = require('chai');
chai.use(require('chai-json-schema'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool, thanks for contributing! 😎

const { assert, expect } = chai;
const writePlugins = require('../scripts/utils/writePlugins.js');
const path = {
test1: '.tmp/test_writePlugins-1.json',
Expand All @@ -24,4 +26,11 @@ describe('utils/writePlugins', () => {
})
.catch(console.warn);
});
it('has valid json', () => {
expect(
require('../plugins.json')
).to.be.jsonSchema(
require('../schema.json')
);
});
});
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ caseless@~0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"

chai-json-schema@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/chai-json-schema/-/chai-json-schema-1.5.0.tgz#6960719e40f71fd5b377c9282e5c9a46799474f6"
dependencies:
jsonpointer.js "0.4.0"
tv4 "~1.2.7"

chai@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
Expand Down Expand Up @@ -893,6 +900,10 @@ jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"

jsonpointer.js@0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/jsonpointer.js/-/jsonpointer.js-0.4.0.tgz#002cb123f767aafdeb0196132ce5c4f9941ccaba"

jsonpointer@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9"
Expand Down Expand Up @@ -1422,6 +1433,10 @@ tunnel-agent@^0.6.0:
dependencies:
safe-buffer "^5.0.1"

tv4@~1.2.7:
version "1.2.7"
resolved "https://registry.yarnpkg.com/tv4/-/tv4-1.2.7.tgz#bd29389afc73ade49ae5f48142b5d544bf68d120"

tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
Expand Down