From 223b644a52330baae59eb8fd9f97b9be78f97fa1 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Thu, 21 Jan 2021 09:41:56 +0000 Subject: [PATCH 1/2] Added JSON Schema for catalogs feed / catalog-entry --- schema/catalog-entry.schema.json | 66 ++++++++++++++++++++++++++++++++ schema/feed.schema.json | 13 +++++++ 2 files changed, 79 insertions(+) create mode 100644 schema/catalog-entry.schema.json diff --git a/schema/catalog-entry.schema.json b/schema/catalog-entry.schema.json new file mode 100644 index 0000000..8ca59c5 --- /dev/null +++ b/schema/catalog-entry.schema.json @@ -0,0 +1,66 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://drafts.opds.io/schema/catalog-entry.schema.json", + "title": "OPDS Catalog Entry", + "type": "object", + "properties": { + "metadata": { + "$ref": "https://readium.org/webpub-manifest/schema/metadata.schema.json" + }, + "links": { + "type": "array", + "items": { + "$ref": "https://readium.org/webpub-manifest/schema/link.schema.json" + }, + "contains": { + "description": "A catalog entry must contain at least one catalog link.", + "properties": { + "rel": { + "anyOf": [ + { + "type": "string", + "enum": [ + "http://opds-spec.org/catalog" + ] + }, + { + "type": "array", + "contains": { + "type": "string", + "enum": [ + "http://opds-spec.org/catalog" + ] + } + } + ] + } + } + } + }, + "image": { + "type": "object", + "title": "Image meant to be displayed to the user when browsing catalogs", + "allOf": [ + { + "$ref": "https://readium.org/webpub-manifest/schema/link.schema.json" + }, + { + "description": "The image resource must use one of the following formats: image/jpeg, image/png or image/gif.", + "properties": { + "type": { + "enum": [ + "image/jpeg", + "image/png", + "image/gif" + ] + } + } + } + ] + } + }, + "required": [ + "metadata", + "links" + ] +} diff --git a/schema/feed.schema.json b/schema/feed.schema.json index c0dcbfb..17bbcc4 100644 --- a/schema/feed.schema.json +++ b/schema/feed.schema.json @@ -37,6 +37,14 @@ ] } }, + "catalogs": { + "description": "A list of catalog-entry objects, to reference other OPDS feeds", + "type": "array", + "items": { + "$ref": "catalog-entry.schema.json" + }, + "uniqueItems": true + }, "publications": { "description": "A list of publications that can be acquired", "type": "array", @@ -142,6 +150,11 @@ "required": [ "groups" ] + }, + { + "required": [ + "catalogs" + ] } ] } From 06db69c6825742a4eef200dfcd0526fa6b89e4f6 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Thu, 21 Jan 2021 11:55:45 +0000 Subject: [PATCH 2/2] Fixed OPDS JSON Schema as per AJV validator --- schema/catalog-entry.schema.json | 1 + schema/feed.schema.json | 2 ++ schema/publication.schema.json | 2 ++ 3 files changed, 5 insertions(+) diff --git a/schema/catalog-entry.schema.json b/schema/catalog-entry.schema.json index 8ca59c5..d41e88f 100644 --- a/schema/catalog-entry.schema.json +++ b/schema/catalog-entry.schema.json @@ -14,6 +14,7 @@ }, "contains": { "description": "A catalog entry must contain at least one catalog link.", + "type": "object", "properties": { "rel": { "anyOf": [ diff --git a/schema/feed.schema.json b/schema/feed.schema.json index 17bbcc4..d5fccf1 100644 --- a/schema/feed.schema.json +++ b/schema/feed.schema.json @@ -16,6 +16,7 @@ }, "uniqueItems": true, "contains": { + "type": "object", "properties": { "rel": { "anyOf": [ @@ -64,6 +65,7 @@ { "description": "Each Link Object in a navigation collection must contain a title", "items": { + "type": "object", "required": [ "title" ] diff --git a/schema/publication.schema.json b/schema/publication.schema.json index 35aa57b..3cd59ae 100644 --- a/schema/publication.schema.json +++ b/schema/publication.schema.json @@ -14,6 +14,7 @@ }, "contains": { "description": "A publication must contain at least one acquisition link.", + "type": "object", "properties": { "rel": { "anyOf": [ @@ -60,6 +61,7 @@ { "description": "At least one image resource must use one of the following formats: image/jpeg, image/png or image/gif.", "contains": { + "type": "object", "properties": { "type": { "enum": [