-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing JSON Schema validation (#71)
* initial work on json schemas * improve schema validation - simplify schemas - validate references for properties - set up enum values for animationType (properties.json) * complete properties.json schema * code style for schema files * Rework travis config to lint json and validate schema * Add notes about `property-reference` validator extension * PR review fixes and related - rephrase comments
- Loading branch information
Showing
12 changed files
with
605 additions
and
9 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 @@ | ||
/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 |
---|---|---|
@@ -1,7 +1,3 @@ | ||
language: node_js | ||
before_script: | ||
- npm install jsonlint -g | ||
script: | ||
- find . -name \*.json | xargs -I {} jsonlint -q {} | ||
notifications: | ||
email: false | ||
sudo: false | ||
script: "npm run travis" |
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,103 @@ | ||
{ | ||
"definitions": { | ||
"stringOrPropertyList": { | ||
"oneOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"type": "string", | ||
"property-reference": { | ||
"comment": "property-reference is an extension to the JSON schema validator. Here it jumps 3 levels up in the hierarchy and tests if a value is an existing key in descriptors. See test/validate-schema.js for implementation details.", | ||
"$data": "3" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"syntax": { | ||
"type": "string" | ||
}, | ||
"interfaces": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"groups": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"descriptors": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"syntax": { | ||
"type": "string" | ||
}, | ||
"media": { | ||
"type": "string" | ||
}, | ||
"initial": { | ||
"$ref": "#/definitions/stringOrPropertyList" | ||
}, | ||
"percentages": { | ||
"$ref": "#/definitions/stringOrPropertyList" | ||
}, | ||
"computed": { | ||
"$ref": "#/definitions/stringOrPropertyList" | ||
}, | ||
"order": { | ||
"enum": [ | ||
"orderOfAppearance", | ||
"uniqueOrder" | ||
] | ||
}, | ||
"status": { | ||
"enum": [ | ||
"standard", | ||
"nonstandard", | ||
"experimental" | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"syntax", | ||
"media", | ||
"initial", | ||
"percentages", | ||
"computed", | ||
"order", | ||
"status" | ||
] | ||
} | ||
}, | ||
"status": { | ||
"enum": [ | ||
"standard", | ||
"nonstandard", | ||
"experimental" | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"syntax", | ||
"groups", | ||
"status" | ||
] | ||
} | ||
} |
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
Oops, something went wrong.