Skip to content

Commit

Permalink
Added subject to JSON Schema
Browse files Browse the repository at this point in the history
closes #8
  • Loading branch information
Hadrien Gardeur committed Apr 4, 2019
1 parent 6930a12 commit dd37f2f
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 26 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
[![Readium Logo](https://readium.org/assets/logos/readium-logo.png)](https://readium.org)

<style>
.rfc {
color: #d55;
font-variant: small-caps;
font-style: normal;
}
</style>

# Readium Web Publication Manifest

The Readium Web Publication Manifest is a JSON-based document meant to represent and distribute publications over HTTPS.
Expand Down Expand Up @@ -363,3 +355,11 @@ In addition to the EPUB format, a Readium Web Publication <span class="rfc">may<
A JSON Schema is available under version control at [https://github.com/readium/webpub-manifest/tree/master/schema](https://github.com/readium/webpub-manifest/tree/master/schema)

For the purpose of validating a Readium Web Publication Manifest, use the following JSON Schema resource: [https://readium.org/webpub-manifest/schema/publication.schema.json](https://readium.org/webpub-manifest/schema/publication.schema.json)

<style>
.rfc {
color: #d55;
font-variant: small-caps;
font-style: normal;
}
</style>
18 changes: 9 additions & 9 deletions contexts/default/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
<style>
.rfc {
color: #d55;
font-variant: small-caps;
font-style: normal;
}
</style>

# Default Context

The Readium Web Publication Manifest defines a shared external context document hosted by the Readium Foundation and based primarily on schema.org and its extensions.
Expand Down Expand Up @@ -398,4 +390,12 @@ If we use another example with more complex metadata expression and an extension

In order to convert EPUB packages into a Readium Web Publication Manifest, we've documented how each metadata item listed in the default context is mapped to an equivalent in EPUB 2.x or 3.x.

This live document is available at: [https://readium.org/architecture/streamer/parser/metadata](https://readium.org/architecture/streamer/parser/metadata)
This live document is available at: [https://readium.org/architecture/streamer/parser/metadata](https://readium.org/architecture/streamer/parser/metadata)

<style>
.rfc {
color: #d55;
font-variant: small-caps;
font-style: normal;
}
</style>
18 changes: 9 additions & 9 deletions extensions/audiobook.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
[![Readium Logo](https://readium.org/assets/logos/readium-logo.png)](https://readium.org)

<style>
.rfc {
color: #d55;
font-variant: small-caps;
font-style: normal;
}
</style>

# Audiobook Profile

## Example
Expand Down Expand Up @@ -97,7 +89,7 @@ In addition, all Link Objects <span class="rfc">should</span> also include the `

In order to support multiple variants of the same audiobook (using a different format or bitrate for instance), Link Objects in the `readingOrder` <span class="rfc">may</span> rely on the `alternate` key:

```
```json
{
"href": "http://example.org/part1.mp3",
"type": "audio/mpeg",
Expand Down Expand Up @@ -139,3 +131,11 @@ Over 10,000+ audiobooks are also available in this format through [the Internet
## Demo

[A demo of the Flatland example is also available](https://player.cantookaudio.com/aHR0cHM6Ly9yZWFkaXVtLm9yZy93ZWJwdWItbWFuaWZlc3QvZXhhbXBsZXMvRmxhdGxhbmQvbWFuaWZlc3QuanNvbg==) through a Web App developed by [De Marque](https://www.demarque.com/).

<style>
.rfc {
color: #d55;
font-variant: small-caps;
font-style: normal;
}
</style>
3 changes: 3 additions & 0 deletions schema/metadata.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
"imprint": {
"$ref": "contributor.schema.json"
},
"subject": {
"$ref": "subject.schema.json"
},
"readingProgression": {
"type": "string",
"enum": [
Expand Down
45 changes: 45 additions & 0 deletions schema/subject-object.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://readium.org/webpub-manifest/schema/subject-object.schema.json",
"title": "Subject Object",
"type": "object",
"properties": {
"name": {
"anyOf": [
{
"type": "string"
},
{
"description": "The language in a language map must be a valid BCP 47 tag.",
"type": "object",
"patternProperties": {
"^((?<grandfathered>(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))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))$": {
"type": "string"
}
},
"additionalProperties": false,
"minProperties": 1
}
]
},
"sortAs": {
"type": "string"
},
"code": {
"type": "string"
},
"scheme": {
"type": "string",
"format": "uri"
},
"links": {
"type": "array",
"items": {
"$ref": "link.schema.json"
}
}
},
"required": [
"name"
]
}
28 changes: 28 additions & 0 deletions schema/subject.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://readium.org/webpub-manifest/schema/subject.schema.json",
"title": "Subject",
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "object",
"$ref": "subject-object.schema.json"
}
]
}
},
{
"type": "object",
"$ref": "subject-object.schema.json"
}
]
}

0 comments on commit dd37f2f

Please sign in to comment.