diff --git a/schema/article.schema.json b/schema/article.schema.json new file mode 100644 index 0000000..b846937 --- /dev/null +++ b/schema/article.schema.json @@ -0,0 +1,83 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://readium.org/webpub-manifest/schema/article.schema.json", + "title": "Article", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/object" + } + ] + } + }, + { + "$ref": "#/$defs/object" + } + ], + "$defs": { + "object": { + "type": "object", + "properties": { + "name": { + "$ref": "language-map.schema.json" + }, + "identifier": { + "type": "string", + "format": "uri" + }, + "altIdentifier": { + "$ref": "altIdentifier.schema.json" + }, + "sortAs": { + "$ref": "language-map.schema.json" + }, + "author": { + "$ref": "contributor.schema.json" + }, + "translator": { + "$ref": "contributor.schema.json" + }, + "editor": { + "$ref": "contributor.schema.json" + }, + "artist": { + "$ref": "contributor.schema.json" + }, + "illustrator": { + "$ref": "contributor.schema.json" + }, + "contributor": { + "$ref": "contributor.schema.json" + }, + "description": { + "type": "string" + }, + "numberOfPages": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "position": { + "type": "number" + }, + "links": { + "type": "array", + "items": { + "$ref": "link.schema.json" + } + } + }, + "required": [ + "name" + ] + } + } +} diff --git a/schema/chapter.schema.json b/schema/chapter.schema.json new file mode 100644 index 0000000..befa6cc --- /dev/null +++ b/schema/chapter.schema.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://readium.org/webpub-manifest/schema/chapter.schema.json", + "title": "Chapter", + "anyOf": [ + { + "type": "number" + }, + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/$defs/object" + } + ] + } + }, + { + "$ref": "#/$defs/object" + } + ], + "$defs": { + "object": { + "type": "object", + "properties": { + "name": { + "$ref": "language-map.schema.json" + }, + "identifier": { + "type": "string", + "format": "uri" + }, + "altIdentifier": { + "$ref": "altIdentifier.schema.json" + }, + "sortAs": { + "$ref": "language-map.schema.json" + }, + "position": { + "type": "number" + }, + "links": { + "type": "array", + "items": { + "$ref": "link.schema.json" + } + } + }, + "required": [ + "position" + ] + } + } +} diff --git a/schema/collection.schema.json b/schema/collection.schema.json new file mode 100644 index 0000000..95c357e --- /dev/null +++ b/schema/collection.schema.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://readium.org/webpub-manifest/schema/collection.schema.json", + "title": "Collection", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/object" + } + ] + } + }, + { + "$ref": "#/$defs/object" + } + ], + "$defs": { + "object": { + "type": "object", + "properties": { + "name": { + "$ref": "language-map.schema.json" + }, + "identifier": { + "type": "string", + "format": "uri" + }, + "altIdentifier": { + "$ref": "altIdentifier.schema.json" + }, + "sortAs": { + "$ref": "language-map.schema.json" + }, + "position": { + "type": "number" + }, + "links": { + "type": "array", + "items": { + "$ref": "link.schema.json" + } + } + }, + "required": [ + "name" + ] + } + } +} diff --git a/schema/contributor-object.schema.json b/schema/contributor-object.schema.json deleted file mode 100644 index ac3577d..0000000 --- a/schema/contributor-object.schema.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://readium.org/webpub-manifest/schema/contributor-object.schema.json", - "title": "Contributor Object", - "type": "object", - "properties": { - "name": { - "$ref": "language-map.schema.json" - }, - "identifier": { - "type": "string", - "format": "uri" - }, - "altIdentifier": { - "$ref": "altIdentifier.schema.json" - }, - "sortAs": { - "$ref": "language-map.schema.json" - }, - "role": { - "type": [ - "string", - "array" - ], - "items": { - "type": "string" - } - }, - "position": { - "type": "number" - }, - "links": { - "type": "array", - "items": { - "$ref": "link.schema.json" - } - } - }, - "required": [ - "name" - ] -} diff --git a/schema/contributor.schema.json b/schema/contributor.schema.json index f94a38e..17f782c 100644 --- a/schema/contributor.schema.json +++ b/schema/contributor.schema.json @@ -14,13 +14,51 @@ "type": "string" }, { - "$ref": "contributor-object.schema.json" + "$ref": "#/$defs/object" } ] } }, { - "$ref": "contributor-object.schema.json" + "$ref": "#/$defs/object" } - ] + ], + "$defs": { + "object": { + "type": "object", + "properties": { + "name": { + "$ref": "language-map.schema.json" + }, + "identifier": { + "type": "string", + "format": "uri" + }, + "altIdentifier": { + "$ref": "altIdentifier.schema.json" + }, + "sortAs": { + "type": "string" + }, + "role": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + }, + "links": { + "type": "array", + "items": { + "$ref": "link.schema.json" + } + } + }, + "required": [ + "name" + ] + } + } } diff --git a/schema/episode.schema.json b/schema/episode.schema.json new file mode 100644 index 0000000..c8e6e41 --- /dev/null +++ b/schema/episode.schema.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://readium.org/webpub-manifest/schema/episode.schema.json", + "title": "Episode", + "anyOf": [ + { + "type": "number" + }, + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/$defs/object" + } + ] + } + }, + { + "$ref": "#/$defs/object" + } + ], + "$defs": { + "object": { + "type": "object", + "properties": { + "name": { + "$ref": "language-map.schema.json" + }, + "identifier": { + "type": "string", + "format": "uri" + }, + "altIdentifier": { + "$ref": "altIdentifier.schema.json" + }, + "sortAs": { + "$ref": "language-map.schema.json" + }, + "position": { + "type": "number" + }, + "links": { + "type": "array", + "items": { + "$ref": "link.schema.json" + } + } + }, + "required": [ + "position" + ] + } + } +} diff --git a/schema/issue.schema.json b/schema/issue.schema.json new file mode 100644 index 0000000..1c57f76 --- /dev/null +++ b/schema/issue.schema.json @@ -0,0 +1,64 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://readium.org/webpub-manifest/schema/issue.schema.json", + "title": "Issue", + "anyOf": [ + { + "type": "number" + }, + { + "type": "array", + "items": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/$defs/object" + } + ] + } + }, + { + "$ref": "#/$defs/object" + } + ], + "$defs": { + "object": { + "type": "object", + "properties": { + "name": { + "$ref": "language-map.schema.json" + }, + "identifier": { + "type": "string", + "format": "uri" + }, + "altIdentifier": { + "$ref": "altIdentifier.schema.json" + }, + "sortAs": { + "$ref": "language-map.schema.json" + }, + "position": { + "type": "number" + }, + "links": { + "type": "array", + "items": { + "$ref": "link.schema.json" + } + }, + "article": { + "$ref": "article.schema.json" + }, + "chapter": { + "$ref": "chapter.schema.json" + } + }, + "required": [ + "position" + ] + } + } +} diff --git a/schema/language-map.schema.json b/schema/language-map.schema.json index 7cb2cdf..81865f8 100644 --- a/schema/language-map.schema.json +++ b/schema/language-map.schema.json @@ -7,6 +7,7 @@ "type": "string" }, { + "description": "The language in a language map must be a valid BCP 47 tag.", "type": "object", "patternProperties": { "^((?(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?([A-Za-z]{2,3}(-(?[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?