forked from MicrosoftEdge/Status
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add process to validate the
status.json
file
- Loading branch information
Showing
7 changed files
with
346 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# For more information about the configurations used | ||
# in this file, please see the EditorConfig documentation: | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
|
||
[*] | ||
|
||
charset = utf-8 | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# For more information about the configurations used | ||
# in this file, please see the Travis CI documentation: | ||
# https://docs.travis-ci.com | ||
|
||
language: node_js | ||
|
||
node_js: | ||
- "node" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"devDependencies": { | ||
"is-my-json-valid": "^2.15.0" | ||
}, | ||
"private": true, | ||
"scripts": { | ||
"test": "node scripts/validate-status-json.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
{ | ||
"$schema": "http://json-schema.org/schema#", | ||
"definitions": { | ||
"feature_categories": { | ||
"enum": [ | ||
"Accessibility", | ||
"CSS", | ||
"DOM", | ||
"Device", | ||
"File APIs", | ||
"Graphics", | ||
"JavaScript", | ||
"Misc", | ||
"Multimedia", | ||
"Network / Connectivity", | ||
"Offline / Storage", | ||
"Performance", | ||
"Realtime / Communication", | ||
"Security", | ||
"User input", | ||
"Web Components" | ||
], | ||
"type": "string" | ||
}, | ||
"feature_priority": { | ||
"enum": [ | ||
"High", | ||
"Low", | ||
"Medium" | ||
], | ||
"type": "string" | ||
}, | ||
"implementation_statuses": { | ||
"enum": [ | ||
"Behind a flag", | ||
"Deprecated", | ||
"Enabled by default", | ||
"In Development", | ||
"No active development", | ||
"No public signals", | ||
"Not currently planned", | ||
"Not Supported", | ||
"Prefixed", | ||
"Preview Release", | ||
"Removed", | ||
"Shipped", | ||
"Under Consideration" | ||
], | ||
"type": "string" | ||
}, | ||
"standard_statuses": { | ||
"enum": [ | ||
"De-facto standard", | ||
"Established standard", | ||
"Working draft or equivalent", | ||
"Editor's draft", | ||
"Public discussion", | ||
"No public standards discussion" | ||
], | ||
"type": "string" | ||
}, | ||
"url": { | ||
"format": "uri", | ||
"type": "string" | ||
}, | ||
"vendor_views": { | ||
"properties": { | ||
"additionalProperties": false, | ||
"text": { | ||
"$ref": "#/definitions/implementation_statuses" | ||
}, | ||
"value": { | ||
"maximum": 12, | ||
"minimum": 1, | ||
"type": "number" | ||
} | ||
}, | ||
"required": [ | ||
"text" | ||
], | ||
"type": "object" | ||
} | ||
}, | ||
"description": "Schema for Microsoft Edge platform status JSON", | ||
"items": { | ||
"additionalProperties": false, | ||
"type": "object", | ||
"properties": { | ||
"category": { | ||
"$ref": "#/definitions/feature_categories" | ||
}, | ||
"demo": { | ||
"$ref": "#/definitions/url" | ||
}, | ||
"ff_views": { | ||
"$ref": "#/definitions/vendor_views" | ||
}, | ||
"ff_views_link": { | ||
"$ref": "#/definitions/url" | ||
}, | ||
"id": { | ||
"type": "number" | ||
}, | ||
"ieStatus": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"flag": { | ||
"type": "boolean" | ||
}, | ||
"iePrefixed": { | ||
"minLength": 1, | ||
"type": "string" | ||
}, | ||
"ieUnprefixed": { | ||
"minLength": 1, | ||
"type": "string" | ||
}, | ||
"priority": { | ||
"$ref": "#/definitions/feature_priority" | ||
}, | ||
"text": { | ||
"$ref": "#/definitions/ximplementation_statuses" | ||
} | ||
}, | ||
"required": [ | ||
"text" | ||
] | ||
}, | ||
"impl_status_chrome": { | ||
"$ref": "#/definitions/implementation_statuses" | ||
}, | ||
"link": { | ||
"$ref": "#/definitions/url" | ||
}, | ||
"msdn": { | ||
"$ref": "#/definitions/url" | ||
}, | ||
"name": { | ||
"minLength": 1, | ||
"type": "string" | ||
}, | ||
"opera_views": { | ||
"$ref": "#/definitions/vendor_views" | ||
}, | ||
"shipped_opera_milestone": { | ||
"type": "boolean" | ||
}, | ||
"safari_views": { | ||
"$ref": "#/definitions/vendor_views" | ||
}, | ||
"safari_views_link": { | ||
"$ref": "#/definitions/url" | ||
}, | ||
"spec": { | ||
"minLength": 1, | ||
"type": "string" | ||
}, | ||
"standardStatus": { | ||
"$ref": "#/definitions/standard_statuses" | ||
}, | ||
"summary": { | ||
"minLength": 20, | ||
"type": "string" | ||
}, | ||
"uservoiceid": { | ||
"type": "number" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"category", | ||
"ieStatus", | ||
"name", | ||
"summary" | ||
], | ||
"type": "array" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const schema = require('./schema.json'); | ||
const statusData = require('./../status.json'); | ||
const validator = require('is-my-json-valid'); | ||
const validate = validator(schema, { | ||
greedy: true, | ||
verbose: true | ||
}); | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
|
||
if (!validate(statusData)) { | ||
console.error(validate.errors); | ||
process.exit(1); | ||
} else { | ||
process.exit(0); | ||
} |
Oops, something went wrong.