-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This provides a first level of schema validation for curated data extracts, see #657 for context. Goal is to make it easier to detect and document (through a changelog, so also useful for #704) situations where we change the structure of data extracts. Schemas, notably those that deal with parsed IDL structures, could go deeper into details. Tests are run against the curated version of data. That is not necessary for extracts that aren't actually curated (dfns, headings, ids, links, refs), just more convenient not to have branching logic in the test code.
- Loading branch information
Showing
16 changed files
with
765 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,134 @@ | ||
{ | ||
"$schema": "http://json-schema.org/schema#", | ||
"$id": "https://w3c.github.io/webref/schemas/common.json", | ||
|
||
"$defs": { | ||
"url": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
|
||
"nullableurl": { | ||
"oneOf": [ | ||
{ "$ref": "#/$defs/url" }, | ||
{ "type": "null" } | ||
], | ||
"$comment": "Extracts sometimes use null values for URLs, they should probably rather drop the property" | ||
}, | ||
|
||
"title": { | ||
"type": "string" | ||
}, | ||
|
||
"shortname": { | ||
"type": "string", | ||
"pattern": "^[\\w\\-]+((?<=-\\d+)\\.\\d+)?$", | ||
"$comment": "Same definition as in browser-specs" | ||
}, | ||
|
||
"specInExtract": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"title": { "$ref": "#/$defs/title" }, | ||
"url": { "$ref": "#/$defs/url" } | ||
}, | ||
"required": ["title", "url"] | ||
}, | ||
|
||
"cssPropertyName": { | ||
"type": "string" | ||
}, | ||
|
||
"cssValue": { | ||
"type": "string" | ||
}, | ||
|
||
"interface": { | ||
"type": "string", | ||
"pattern": "^[A-Z]([A-Za-z0-9_])*|console$", | ||
"$comment": "console is the only interface name that starts with a lower-case character" | ||
}, | ||
|
||
"global": { | ||
"oneOf": [ | ||
{ "$ref": "#/$defs/interface" }, | ||
{ "type": "string", "const": "*" } | ||
] | ||
}, | ||
|
||
"id": { | ||
"type": "string" | ||
}, | ||
|
||
"headingNumber": { | ||
"type": "string", | ||
"pattern": "^(\\d+|[A-Z])(\\.\\d+)*$", | ||
"$comment": "Note appendices start with an upper-case A-Z character" | ||
}, | ||
|
||
"interfaces": { | ||
"type": "array", | ||
"items": { "$ref": "#/$defs/interface" } | ||
}, | ||
|
||
"interfacesByGlobal": { | ||
"type": "object", | ||
"propertyNames": { "$ref": "#/$defs/global" }, | ||
"additionalProperties": { "$ref": "#/$defs/interfaces" } | ||
}, | ||
|
||
"idlFragmentInSpec": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["spec", "fragment"], | ||
"properties": { | ||
"spec": { "$ref": "#/$defs/specInExtract" }, | ||
"fragment": { "type": "string" }, | ||
"href": { "$ref": "#/$defs/url" } | ||
} | ||
}, | ||
|
||
"idlnameparsed": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["name", "type", "defined", "extended", "includes"], | ||
"properties": { | ||
"name": { "$ref": "#/$defs/interface" }, | ||
"type": { | ||
"type": "string", | ||
"enum": ["dictionary", "interface", "interface mixin", "enum", "typedef", | ||
"callback", "callback interface", "namespace"] | ||
}, | ||
"defined": { "$ref": "#/$defs/idlFragmentInSpec" }, | ||
"extended": { | ||
"type": "array", | ||
"items": { "$ref": "#/$defs/idlFragmentInSpec" } | ||
}, | ||
"inheritance": { | ||
"oneOf": [ | ||
{ "type": "null" }, | ||
{ "$ref": "#/$defs/idlnameparsed" } | ||
] | ||
}, | ||
"includes": { | ||
"type": "array", | ||
"items": { "$ref": "#/$defs/idlnameparsed" } | ||
} | ||
} | ||
}, | ||
|
||
"references": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["name"], | ||
"properties": { | ||
"name": { "type": "string" }, | ||
"url": { "$ref": "#/$defs/url" } | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.