diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f3f76fd Binary files /dev/null and b/.DS_Store differ diff --git a/SPEC.md b/SPEC.md index f28a39e..e5d4897 100644 --- a/SPEC.md +++ b/SPEC.md @@ -1016,20 +1016,24 @@ interface CarouselCard extends Node { * @description unique identifier required for component tracking */ id: string - /** - * @description Heading (60 characters recommended) - */ - title: string /** * @description Image + * @sparkMapNodeType image */ children: [ImageSet] + /** + * @description Heading (60 characters recommended) + * @sparkMapNodeType textInput + */ + title: string /** * @description Body text (200 characters recommended) + * @sparkMapNodeType textInput */ copy: string /** * @description Details (optional, 60 characters recommended) + * @sparkMapNodeType textInput */ additionalInfo?: string } @@ -1048,16 +1052,6 @@ type CarouselChildren = CarouselCard[] ``` **CarouselChildren** the array of carousel cards that make up a carousel -#### `CarouselHeading` -```ts -interface CarouselHeading extends Node { - type: "carousel-heading" - title: string - standfirst?: string -} -``` -**CarouselHeading** is the main header for a carousel component - #### `Carousel` ```ts /** @@ -1069,7 +1063,14 @@ interface Carousel extends Parent { * @description unique identifier required for component tracking */ id: string - heading?: CarouselHeading + /** + @sparkMapNodeType textInput + */ + title?: string + /** + @sparkMapNodeType textInput + */ + standfirst?: string children: CarouselChildren } ``` diff --git a/build.bash b/build.bash index 6455fb1..1eb2a8c 100755 --- a/build.bash +++ b/build.bash @@ -2,7 +2,8 @@ node tools/maketypes content-tree.ts tsc -d content-tree.ts typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json -typescript-json-schema --validationKeywords sparkGenerateStoryblock sparkRepeater minItem maxItem --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json +typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json +typescript-json-schema --validationKeywords sparkMapNodeType sparkGenerateStoryblock sparkRepeater minItem maxItem --propOrder --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/spark-transit-tree.schema.json rm content-tree.ts rm content-tree.js diff --git a/content-tree.d.ts b/content-tree.d.ts index 2fc347f..9e03533 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -445,20 +445,24 @@ export declare namespace ContentTree { * @description unique identifier required for component tracking */ id: string; - /** - * @description Heading (60 characters recommended) - */ - title: string; /** * @description Image + * @sparkMapNodeType image */ children: [ImageSet]; + /** + * @description Heading (60 characters recommended) + * @sparkMapNodeType textInput + */ + title: string; /** * @description Body text (200 characters recommended) + * @sparkMapNodeType textInput */ copy: string; /** * @description Details (optional, 60 characters recommended) + * @sparkMapNodeType textInput */ additionalInfo?: string; } @@ -469,11 +473,6 @@ export declare namespace ContentTree { * @sparkRepeater true */ type CarouselChildren = CarouselCard[]; - interface CarouselHeading extends Node { - type: "carousel-heading"; - title: string; - standfirst?: string; - } /** * @sparkGenerateStoryblock true */ @@ -483,7 +482,14 @@ export declare namespace ContentTree { * @description unique identifier required for component tracking */ id: string; - heading?: CarouselHeading; + /** + @sparkMapNodeType textInput + */ + title?: string; + /** + @sparkMapNodeType textInput + */ + standfirst?: string; children: CarouselChildren; } namespace full { @@ -933,20 +939,24 @@ export declare namespace ContentTree { * @description unique identifier required for component tracking */ id: string; - /** - * @description Heading (60 characters recommended) - */ - title: string; /** * @description Image + * @sparkMapNodeType image */ children: [ImageSet]; + /** + * @description Heading (60 characters recommended) + * @sparkMapNodeType textInput + */ + title: string; /** * @description Body text (200 characters recommended) + * @sparkMapNodeType textInput */ copy: string; /** * @description Details (optional, 60 characters recommended) + * @sparkMapNodeType textInput */ additionalInfo?: string; } @@ -957,11 +967,6 @@ export declare namespace ContentTree { * @sparkRepeater true */ type CarouselChildren = CarouselCard[]; - interface CarouselHeading extends Node { - type: "carousel-heading"; - title: string; - standfirst?: string; - } /** * @sparkGenerateStoryblock true */ @@ -971,7 +976,14 @@ export declare namespace ContentTree { * @description unique identifier required for component tracking */ id: string; - heading?: CarouselHeading; + /** + @sparkMapNodeType textInput + */ + title?: string; + /** + @sparkMapNodeType textInput + */ + standfirst?: string; children: CarouselChildren; } } @@ -1395,20 +1407,24 @@ export declare namespace ContentTree { * @description unique identifier required for component tracking */ id: string; - /** - * @description Heading (60 characters recommended) - */ - title: string; /** * @description Image + * @sparkMapNodeType image */ children: [ImageSet]; + /** + * @description Heading (60 characters recommended) + * @sparkMapNodeType textInput + */ + title: string; /** * @description Body text (200 characters recommended) + * @sparkMapNodeType textInput */ copy: string; /** * @description Details (optional, 60 characters recommended) + * @sparkMapNodeType textInput */ additionalInfo?: string; } @@ -1419,11 +1435,6 @@ export declare namespace ContentTree { * @sparkRepeater true */ type CarouselChildren = CarouselCard[]; - interface CarouselHeading extends Node { - type: "carousel-heading"; - title: string; - standfirst?: string; - } /** * @sparkGenerateStoryblock true */ @@ -1433,7 +1444,14 @@ export declare namespace ContentTree { * @description unique identifier required for component tracking */ id: string; - heading?: CarouselHeading; + /** + @sparkMapNodeType textInput + */ + title?: string; + /** + @sparkMapNodeType textInput + */ + standfirst?: string; children: CarouselChildren; } } @@ -1884,20 +1902,24 @@ export declare namespace ContentTree { * @description unique identifier required for component tracking */ id: string; - /** - * @description Heading (60 characters recommended) - */ - title: string; /** * @description Image + * @sparkMapNodeType image */ children: [ImageSet]; + /** + * @description Heading (60 characters recommended) + * @sparkMapNodeType textInput + */ + title: string; /** * @description Body text (200 characters recommended) + * @sparkMapNodeType textInput */ copy: string; /** * @description Details (optional, 60 characters recommended) + * @sparkMapNodeType textInput */ additionalInfo?: string; } @@ -1908,11 +1930,6 @@ export declare namespace ContentTree { * @sparkRepeater true */ type CarouselChildren = CarouselCard[]; - interface CarouselHeading extends Node { - type: "carousel-heading"; - title: string; - standfirst?: string; - } /** * @sparkGenerateStoryblock true */ @@ -1922,7 +1939,14 @@ export declare namespace ContentTree { * @description unique identifier required for component tracking */ id: string; - heading?: CarouselHeading; + /** + @sparkMapNodeType textInput + */ + title?: string; + /** + @sparkMapNodeType textInput + */ + standfirst?: string; children: CarouselChildren; } } diff --git a/package.json b/package.json index 70e5724..62948f2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@financial-times/content-tree", "description": "content tree format", - "version": "0.13.0", + "version": "0.14.0", "publishConfig": { "access": "public" }, diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index 58e036a..ab2f001 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -265,13 +265,16 @@ "type": "array" }, "data": {}, - "heading": { - "$ref": "#/definitions/ContentTree.transit.CarouselHeading" - }, "id": { "description": "unique identifier required for component tracking", "type": "string" }, + "standfirst": { + "type": "string" + }, + "title": { + "type": "string" + }, "type": { "const": "carousel", "type": "string" @@ -329,27 +332,6 @@ ], "type": "object" }, - "ContentTree.transit.CarouselHeading": { - "additionalProperties": false, - "properties": { - "data": {}, - "standfirst": { - "type": "string" - }, - "title": { - "type": "string" - }, - "type": { - "const": "carousel-heading", - "type": "string" - } - }, - "required": [ - "title", - "type" - ], - "type": "object" - }, "ContentTree.transit.ClipSet": { "additionalProperties": false, "properties": { diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index 0ecf377..5b85867 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -302,13 +302,16 @@ "type": "array" }, "data": {}, - "heading": { - "$ref": "#/definitions/ContentTree.full.CarouselHeading" - }, "id": { "description": "unique identifier required for component tracking", "type": "string" }, + "standfirst": { + "type": "string" + }, + "title": { + "type": "string" + }, "type": { "const": "carousel", "type": "string" @@ -366,27 +369,6 @@ ], "type": "object" }, - "ContentTree.full.CarouselHeading": { - "additionalProperties": false, - "properties": { - "data": {}, - "standfirst": { - "type": "string" - }, - "title": { - "type": "string" - }, - "type": { - "const": "carousel-heading", - "type": "string" - } - }, - "required": [ - "title", - "type" - ], - "type": "object" - }, "ContentTree.full.ClipSet": { "additionalProperties": false, "properties": { diff --git a/schemas/spark-transit-tree.schema.json b/schemas/spark-transit-tree.schema.json new file mode 100644 index 0000000..e57e52f --- /dev/null +++ b/schemas/spark-transit-tree.schema.json @@ -0,0 +1,2165 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "definitions": { + "ContentTree.transit.AcastPodcast": { + "additionalProperties": false, + "properties": { + "data": {}, + "type": { + "const": "acast-podcast", + "type": "string" + }, + "url": { + "description": "Acast Podcast embed url e.g. https://embed.acast.com/*", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "url", + "data" + ], + "required": [ + "type", + "url" + ], + "type": "object" + }, + "ContentTree.transit.BigNumber": { + "additionalProperties": false, + "properties": { + "data": {}, + "description": { + "type": "string" + }, + "number": { + "type": "string" + }, + "type": { + "const": "big-number", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "number", + "description", + "data" + ], + "required": [ + "description", + "number", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Blockquote": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Text" + }, + { + "$ref": "#/definitions/ContentTree.transit.Break" + }, + { + "$ref": "#/definitions/ContentTree.transit.Strong" + }, + { + "$ref": "#/definitions/ContentTree.transit.Emphasis" + }, + { + "$ref": "#/definitions/ContentTree.transit.Strikethrough" + }, + { + "$ref": "#/definitions/ContentTree.transit.Subscript" + }, + { + "$ref": "#/definitions/ContentTree.transit.Superscript" + }, + { + "$ref": "#/definitions/ContentTree.transit.Link" + }, + { + "$ref": "#/definitions/ContentTree.transit.FindOutMoreLink" + } + ] + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "blockquote", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Body": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.BodyBlock" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "body", + "type": "string" + }, + "version": { + "type": "number" + } + }, + "propertyOrder": [ + "type", + "version", + "children", + "data" + ], + "required": [ + "children", + "type", + "version" + ], + "type": "object" + }, + "ContentTree.transit.BodyBlock": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Heading" + }, + { + "$ref": "#/definitions/ContentTree.transit.List" + }, + { + "$ref": "#/definitions/ContentTree.transit.Blockquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.ThematicBreak" + }, + { + "$ref": "#/definitions/ContentTree.transit.Text" + }, + { + "$ref": "#/definitions/ContentTree.transit.AcastPodcast" + }, + { + "$ref": "#/definitions/ContentTree.transit.BigNumber" + }, + { + "$ref": "#/definitions/ContentTree.transit.Carousel" + }, + { + "$ref": "#/definitions/ContentTree.transit.ClipSet" + }, + { + "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" + }, + { + "$ref": "#/definitions/ContentTree.transit.Definition" + }, + { + "$ref": "#/definitions/ContentTree.transit.Flourish" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImagePair" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + }, + { + "$ref": "#/definitions/ContentTree.transit.InfoBox" + }, + { + "$ref": "#/definitions/ContentTree.transit.InfoPair" + }, + { + "$ref": "#/definitions/ContentTree.transit.InNumbers" + }, + { + "$ref": "#/definitions/ContentTree.transit.Layout" + }, + { + "$ref": "#/definitions/ContentTree.transit.Pullquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.Recommended" + }, + { + "$ref": "#/definitions/ContentTree.transit.RecommendedList" + }, + { + "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" + }, + { + "$ref": "#/definitions/ContentTree.transit.Table" + }, + { + "$ref": "#/definitions/ContentTree.transit.Timeline" + }, + { + "$ref": "#/definitions/ContentTree.transit.Tweet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Video" + }, + { + "$ref": "#/definitions/ContentTree.transit.VimeoVideo" + }, + { + "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" + } + ] + }, + "ContentTree.transit.Break": { + "additionalProperties": false, + "properties": { + "data": {}, + "type": { + "const": "break", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "data" + ], + "required": [ + "type" + ], + "type": "object" + }, + "ContentTree.transit.Card": { + "additionalProperties": false, + "description": "A card describes a subject with images and text", + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.CardChildren" + }, + "type": "array" + }, + "data": {}, + "title": { + "description": "The title of this card", + "type": "string" + }, + "type": { + "const": "card", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "title", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.CardChildren": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Heading" + }, + { + "$ref": "#/definitions/ContentTree.transit.List" + }, + { + "$ref": "#/definitions/ContentTree.transit.Blockquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.ThematicBreak" + }, + { + "$ref": "#/definitions/ContentTree.transit.Text" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + } + ], + "description": "Allowed children for a card" + }, + "ContentTree.transit.Carousel": { + "additionalProperties": false, + "properties": { + "children": { + "description": "Carousel item", + "items": { + "$ref": "#/definitions/ContentTree.transit.CarouselCard" + }, + "maxItems": 10, + "minItems": 4, + "sparkRepeater": true, + "type": "array" + }, + "data": {}, + "id": { + "description": "unique identifier required for component tracking", + "type": "string" + }, + "standfirst": { + "sparkMapNodeType": "textInput", + "type": "string" + }, + "title": { + "sparkMapNodeType": "textInput", + "type": "string" + }, + "type": { + "const": "carousel", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "title", + "standfirst", + "children", + "data" + ], + "required": [ + "children", + "id", + "type" + ], + "sparkGenerateStoryblock": true, + "type": "object" + }, + "ContentTree.transit.CarouselCard": { + "additionalProperties": false, + "properties": { + "additionalInfo": { + "description": "Details (optional, 60 characters recommended)", + "sparkMapNodeType": "textInput", + "type": "string" + }, + "children": { + "description": "Image", + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + } + ], + "maxItems": 1, + "minItems": 1, + "sparkMapNodeType": "image", + "type": "array" + }, + "copy": { + "description": "Body text (200 characters recommended)", + "sparkMapNodeType": "textInput", + "type": "string" + }, + "data": {}, + "id": { + "description": "unique identifier required for component tracking", + "type": "string" + }, + "title": { + "description": "Heading (60 characters recommended)", + "sparkMapNodeType": "textInput", + "type": "string" + }, + "type": { + "const": "carousel-card", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "children", + "title", + "copy", + "additionalInfo", + "data" + ], + "required": [ + "children", + "copy", + "id", + "title", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ClipSet": { + "additionalProperties": false, + "properties": { + "autoplay": { + "type": "boolean" + }, + "data": {}, + "fragmentIdentifier": { + "type": "string" + }, + "id": { + "type": "string" + }, + "layoutWidth": { + "$ref": "#/definitions/ContentTree.transit.ClipSetLayoutWidth" + }, + "loop": { + "type": "boolean" + }, + "muted": { + "type": "boolean" + }, + "type": { + "const": "clip-set", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "layoutWidth", + "autoplay", + "fragmentIdentifier", + "loop", + "muted", + "data" + ], + "required": [ + "id", + "layoutWidth", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ClipSetLayoutWidth": { + "enum": [ + "full-grid", + "in-line", + "mid-grid" + ], + "type": "string" + }, + "ContentTree.transit.CustomCodeComponent": { + "additionalProperties": false, + "properties": { + "data": {}, + "id": { + "description": "Id taken from the CAPI url", + "type": "string" + }, + "layoutWidth": { + "$ref": "#/definitions/ContentTree.transit.LayoutWidth", + "description": "How the component should be presented in the article page according to the column layout system" + }, + "type": { + "const": "custom-code-component", + "description": "Component type", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "layoutWidth", + "data" + ], + "required": [ + "id", + "layoutWidth", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Definition": { + "additionalProperties": false, + "description": "A definition has a term and a related description. It is used to describe a term.", + "properties": { + "data": {}, + "description": { + "type": "string" + }, + "term": { + "type": "string" + }, + "type": { + "const": "definition", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "term", + "description", + "data" + ], + "required": [ + "description", + "term", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Emphasis": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "emphasis", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.FindOutMoreLink": { + "additionalProperties": false, + "properties": { + "children": { + "items": [ + { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Text" + }, + { + "$ref": "#/definitions/ContentTree.transit.Strong" + }, + { + "$ref": "#/definitions/ContentTree.transit.Emphasis" + } + ] + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "data": {}, + "type": { + "const": "find-out-more-link", + "type": "string" + }, + "url": { + "type": "string" + } + }, + "propertyOrder": [ + "type", + "url", + "children", + "data" + ], + "required": [ + "children", + "type", + "url" + ], + "type": "object" + }, + "ContentTree.transit.Flourish": { + "additionalProperties": false, + "properties": { + "data": {}, + "description": { + "type": "string" + }, + "flourishType": { + "type": "string" + }, + "fragmentIdentifier": { + "type": "string" + }, + "id": { + "type": "string" + }, + "layoutWidth": { + "$ref": "#/definitions/ContentTree.transit.FlourishLayoutWidth" + }, + "timestamp": { + "type": "string" + }, + "type": { + "const": "flourish", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "layoutWidth", + "flourishType", + "description", + "timestamp", + "fragmentIdentifier", + "data" + ], + "required": [ + "flourishType", + "id", + "layoutWidth", + "type" + ], + "type": "object" + }, + "ContentTree.transit.FlourishLayoutWidth": { + "enum": [ + "full-grid", + "in-line" + ], + "type": "string" + }, + "ContentTree.transit.Heading": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Text" + }, + "type": "array" + }, + "data": {}, + "fragmentIdentifier": { + "type": "string" + }, + "level": { + "enum": [ + "chapter", + "label", + "subheading" + ], + "type": "string" + }, + "type": { + "const": "heading", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "level", + "fragmentIdentifier", + "data" + ], + "required": [ + "children", + "level", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ImagePair": { + "additionalProperties": false, + "properties": { + "children": { + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + } + ], + "maxItems": 2, + "minItems": 2, + "type": "array" + }, + "data": {}, + "type": { + "const": "image-pair", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ImageSet": { + "additionalProperties": false, + "properties": { + "data": {}, + "fragmentIdentifier": { + "type": "string" + }, + "id": { + "type": "string" + }, + "type": { + "const": "image-set", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "fragmentIdentifier", + "data" + ], + "required": [ + "id", + "type" + ], + "type": "object" + }, + "ContentTree.transit.InNumbers": { + "additionalProperties": false, + "description": "InNumbers represents a set of numbers with related descriptions.", + "properties": { + "children": { + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.Definition" + }, + { + "$ref": "#/definitions/ContentTree.transit.Definition" + }, + { + "$ref": "#/definitions/ContentTree.transit.Definition" + } + ], + "maxItems": 3, + "minItems": 3, + "type": "array" + }, + "data": {}, + "title": { + "description": "The title for the InNumbers", + "type": "string" + }, + "type": { + "const": "in-numbers", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "title", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.InfoBox": { + "additionalProperties": false, + "description": "An info box describes a subject via a single card", + "properties": { + "children": { + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.Card" + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "data": {}, + "layoutWidth": { + "$ref": "#/definitions/ContentTree.transit.InfoBoxLayoutWidth", + "description": "The layout width supported by this node" + }, + "type": { + "const": "info-box", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "layoutWidth", + "children", + "data" + ], + "required": [ + "children", + "layoutWidth", + "type" + ], + "type": "object" + }, + "ContentTree.transit.InfoBoxLayoutWidth": { + "description": "Allowed layout widths for an InfoBox.", + "enum": [ + "in-line", + "inset-left" + ], + "type": "string" + }, + "ContentTree.transit.InfoPair": { + "additionalProperties": false, + "description": "InfoPair provides exactly two cards.", + "properties": { + "children": { + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.Card" + }, + { + "$ref": "#/definitions/ContentTree.transit.Card" + } + ], + "maxItems": 2, + "minItems": 2, + "type": "array" + }, + "data": {}, + "title": { + "description": "The title of the info pair", + "type": "string" + }, + "type": { + "const": "info-pair", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "title", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Layout": { + "additionalProperties": false, + "properties": { + "children": { + "anyOf": [ + { + "additionalItems": { + "$ref": "#/definitions/ContentTree.transit.LayoutSlot" + }, + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.Heading" + }, + { + "$ref": "#/definitions/ContentTree.transit.LayoutImage" + } + ], + "minItems": 2, + "type": "array" + }, + { + "additionalItems": { + "$ref": "#/definitions/ContentTree.transit.LayoutSlot" + }, + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.Heading" + } + ], + "minItems": 1, + "type": "array" + }, + { + "items": { + "$ref": "#/definitions/ContentTree.transit.LayoutSlot" + }, + "type": "array" + } + ] + }, + "data": {}, + "layoutName": { + "enum": [ + "auto", + "card", + "timeline" + ], + "type": "string" + }, + "layoutWidth": { + "type": "string" + }, + "type": { + "const": "layout", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "layoutName", + "layoutWidth", + "children", + "data" + ], + "required": [ + "children", + "layoutName", + "layoutWidth", + "type" + ], + "type": "object" + }, + "ContentTree.transit.LayoutImage": { + "additionalProperties": false, + "properties": { + "alt": { + "type": "string" + }, + "caption": { + "type": "string" + }, + "credit": { + "type": "string" + }, + "data": {}, + "id": { + "type": "string" + }, + "type": { + "const": "layout-image", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "alt", + "caption", + "credit", + "data" + ], + "required": [ + "alt", + "caption", + "credit", + "id", + "type" + ], + "type": "object" + }, + "ContentTree.transit.LayoutSlot": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Heading" + }, + { + "$ref": "#/definitions/ContentTree.transit.LayoutImage" + } + ] + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "layout-slot", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.LayoutWidth": { + "enum": [ + "auto", + "full-bleed", + "full-grid", + "full-width", + "in-line", + "inset-left", + "inset-right", + "mid-grid" + ], + "type": "string" + }, + "ContentTree.transit.Link": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "title": { + "type": "string" + }, + "type": { + "const": "link", + "type": "string" + }, + "url": { + "type": "string" + } + }, + "propertyOrder": [ + "type", + "url", + "title", + "children", + "data" + ], + "required": [ + "children", + "title", + "type", + "url" + ], + "type": "object" + }, + "ContentTree.transit.List": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.ListItem" + }, + "type": "array" + }, + "data": {}, + "ordered": { + "type": "boolean" + }, + "type": { + "const": "list", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "ordered", + "children", + "data" + ], + "required": [ + "children", + "ordered", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ListItem": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Text" + }, + { + "$ref": "#/definitions/ContentTree.transit.Break" + }, + { + "$ref": "#/definitions/ContentTree.transit.Strong" + }, + { + "$ref": "#/definitions/ContentTree.transit.Emphasis" + }, + { + "$ref": "#/definitions/ContentTree.transit.Strikethrough" + }, + { + "$ref": "#/definitions/ContentTree.transit.Subscript" + }, + { + "$ref": "#/definitions/ContentTree.transit.Superscript" + }, + { + "$ref": "#/definitions/ContentTree.transit.Link" + }, + { + "$ref": "#/definitions/ContentTree.transit.FindOutMoreLink" + } + ] + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "list-item", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Paragraph": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "paragraph", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Phrasing": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Text" + }, + { + "$ref": "#/definitions/ContentTree.transit.Break" + }, + { + "$ref": "#/definitions/ContentTree.transit.Strong" + }, + { + "$ref": "#/definitions/ContentTree.transit.Emphasis" + }, + { + "$ref": "#/definitions/ContentTree.transit.Strikethrough" + }, + { + "$ref": "#/definitions/ContentTree.transit.Subscript" + }, + { + "$ref": "#/definitions/ContentTree.transit.Superscript" + }, + { + "$ref": "#/definitions/ContentTree.transit.Link" + }, + { + "$ref": "#/definitions/ContentTree.transit.FindOutMoreLink" + } + ] + }, + "ContentTree.transit.Pullquote": { + "additionalProperties": false, + "properties": { + "data": {}, + "source": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "const": "pullquote", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "text", + "source", + "data" + ], + "required": [ + "text", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Recommended": { + "additionalProperties": false, + "properties": { + "data": {}, + "heading": { + "type": "string" + }, + "id": { + "type": "string" + }, + "teaserTitleOverride": { + "type": "string" + }, + "type": { + "const": "recommended", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "heading", + "teaserTitleOverride", + "data" + ], + "required": [ + "id", + "type" + ], + "type": "object" + }, + "ContentTree.transit.RecommendedList": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Recommended" + }, + "type": "array" + }, + "data": {}, + "heading": { + "type": "string" + }, + "type": { + "const": "recommended-list", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "heading", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ScrollyBlock": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.ScrollySection" + }, + "type": "array" + }, + "data": {}, + "theme": { + "enum": [ + "sans", + "serif" + ], + "type": "string" + }, + "type": { + "const": "scrolly-block", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "theme", + "children", + "data" + ], + "required": [ + "children", + "theme", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ScrollyCopy": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.ScrollyHeading" + } + ] + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "scrolly-copy", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ScrollyHeading": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Text" + }, + "type": "array" + }, + "data": {}, + "level": { + "enum": [ + "chapter", + "heading", + "subheading" + ], + "type": "string" + }, + "type": { + "const": "scrolly-heading", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "level", + "children", + "data" + ], + "required": [ + "children", + "level", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ScrollyImage": { + "additionalProperties": false, + "properties": { + "data": {}, + "id": { + "type": "string" + }, + "type": { + "const": "scrolly-image", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "data" + ], + "required": [ + "id", + "type" + ], + "type": "object" + }, + "ContentTree.transit.ScrollySection": { + "additionalProperties": false, + "properties": { + "children": { + "additionalItems": { + "$ref": "#/definitions/ContentTree.transit.ScrollyCopy" + }, + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.ScrollyImage" + } + ], + "minItems": 1, + "type": "array" + }, + "data": {}, + "display": { + "enum": [ + "dark-background", + "light-background" + ], + "type": "string" + }, + "noBox": { + "const": true, + "type": "boolean" + }, + "position": { + "enum": [ + "center", + "left", + "right" + ], + "type": "string" + }, + "transition": { + "enum": [ + "delay-after", + "delay-before" + ], + "type": "string" + }, + "type": { + "const": "scrolly-section", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "display", + "noBox", + "position", + "transition", + "children", + "data" + ], + "required": [ + "children", + "display", + "position", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Strikethrough": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "strikethrough", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Strong": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "strong", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Subscript": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "subscript", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Superscript": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "superscript", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Table": { + "additionalProperties": false, + "properties": { + "children": { + "$ref": "#/definitions/ContentTree.transit.TableChildren" + }, + "collapseAfterHowManyRows": { + "type": "number" + }, + "columnSettings": { + "items": { + "additionalProperties": false, + "properties": { + "hideOnMobile": { + "type": "boolean" + }, + "sortType": { + "enum": [ + "currency", + "date", + "number", + "percent", + "text" + ], + "type": "string" + }, + "sortable": { + "type": "boolean" + } + }, + "propertyOrder": [ + "hideOnMobile", + "sortable", + "sortType" + ], + "required": [ + "hideOnMobile", + "sortable" + ], + "type": "object" + }, + "type": "array" + }, + "compact": { + "type": "boolean" + }, + "data": {}, + "layoutWidth": { + "$ref": "#/definitions/ContentTree.transit.TableLayoutWidth" + }, + "responsiveStyle": { + "enum": [ + "flat", + "overflow", + "scroll" + ], + "type": "string" + }, + "stripes": { + "type": "boolean" + }, + "type": { + "const": "table", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "stripes", + "compact", + "layoutWidth", + "collapseAfterHowManyRows", + "responsiveStyle", + "columnSettings", + "children", + "data" + ], + "required": [ + "children", + "columnSettings", + "compact", + "layoutWidth", + "responsiveStyle", + "stripes", + "type" + ], + "type": "object" + }, + "ContentTree.transit.TableBody": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.TableRow" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "table-body", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.TableCaption": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "table-caption", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.TableCell": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "columnSpan": { + "type": "number" + }, + "data": {}, + "heading": { + "type": "boolean" + }, + "rowSpan": { + "type": "number" + }, + "type": { + "const": "table-cell", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "heading", + "columnSpan", + "rowSpan", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.TableChildren": { + "anyOf": [ + { + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.TableCaption" + }, + { + "$ref": "#/definitions/ContentTree.transit.TableBody" + }, + { + "$ref": "#/definitions/ContentTree.transit.TableFooter" + } + ], + "maxItems": 3, + "minItems": 2, + "type": "array" + }, + { + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.TableBody" + }, + { + "$ref": "#/definitions/ContentTree.transit.TableFooter" + } + ], + "maxItems": 2, + "minItems": 1, + "type": "array" + }, + { + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.TableCaption" + }, + { + "$ref": "#/definitions/ContentTree.transit.TableHeader" + }, + { + "$ref": "#/definitions/ContentTree.transit.TableBody" + }, + { + "$ref": "#/definitions/ContentTree.transit.TableFooter" + } + ], + "maxItems": 4, + "minItems": 3, + "type": "array" + }, + { + "items": [ + { + "$ref": "#/definitions/ContentTree.transit.TableHeader" + }, + { + "$ref": "#/definitions/ContentTree.transit.TableBody" + }, + { + "$ref": "#/definitions/ContentTree.transit.TableFooter" + } + ], + "maxItems": 3, + "minItems": 2, + "type": "array" + } + ] + }, + "ContentTree.transit.TableFooter": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.Phrasing" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "table-footer", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.TableHeader": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.TableRow" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "table-header", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.TableLayoutWidth": { + "enum": [ + "auto", + "full-bleed", + "full-grid", + "inset-left", + "inset-right" + ], + "type": "string" + }, + "ContentTree.transit.TableRow": { + "additionalProperties": false, + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.TableCell" + }, + "type": "array" + }, + "data": {}, + "type": { + "const": "table-row", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "children", + "data" + ], + "required": [ + "children", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Text": { + "additionalProperties": false, + "properties": { + "data": {}, + "type": { + "const": "text", + "type": "string" + }, + "value": { + "type": "string" + } + }, + "propertyOrder": [ + "type", + "value", + "data" + ], + "required": [ + "type", + "value" + ], + "type": "object" + }, + "ContentTree.transit.ThematicBreak": { + "additionalProperties": false, + "properties": { + "data": {}, + "type": { + "const": "thematic-break", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "data" + ], + "required": [ + "type" + ], + "type": "object" + }, + "ContentTree.transit.Timeline": { + "additionalProperties": false, + "description": "Timeline nodes display a timeline of events in arbitrary order.", + "properties": { + "children": { + "items": { + "$ref": "#/definitions/ContentTree.transit.TimelineEvent" + }, + "type": "array" + }, + "data": {}, + "title": { + "description": "The title for the timeline", + "type": "string" + }, + "type": { + "const": "timeline", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "title", + "children", + "data" + ], + "required": [ + "children", + "title", + "type" + ], + "type": "object" + }, + "ContentTree.transit.TimelineEvent": { + "additionalProperties": false, + "description": "TimelineEvent is the representation of a single event in a Timeline.", + "properties": { + "children": { + "description": "Any combination of paragraphs and image sets", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + } + ] + }, + "type": "array" + }, + "data": {}, + "title": { + "description": "The title of the event", + "type": "string" + }, + "type": { + "const": "timeline-event", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "title", + "children", + "data" + ], + "required": [ + "children", + "title", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Tweet": { + "additionalProperties": false, + "properties": { + "data": {}, + "id": { + "type": "string" + }, + "type": { + "const": "tweet", + "type": "string" + } + }, + "propertyOrder": [ + "id", + "type", + "data" + ], + "required": [ + "id", + "type" + ], + "type": "object" + }, + "ContentTree.transit.Video": { + "additionalProperties": false, + "properties": { + "data": {}, + "id": { + "type": "string" + }, + "type": { + "const": "video", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "id", + "data" + ], + "required": [ + "id", + "type" + ], + "type": "object" + }, + "ContentTree.transit.VimeoVideo": { + "additionalProperties": false, + "properties": { + "data": {}, + "type": { + "const": "vimeo-video", + "type": "string" + }, + "url": { + "description": "Vimeo embed URL e.g. https://player.vimeo.com/player/ or https://vimeo.com/", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "url", + "data" + ], + "required": [ + "type", + "url" + ], + "type": "object" + }, + "ContentTree.transit.YoutubeVideo": { + "additionalProperties": false, + "properties": { + "data": {}, + "type": { + "const": "youtube-video", + "type": "string" + }, + "url": { + "type": "string" + } + }, + "propertyOrder": [ + "type", + "url", + "data" + ], + "required": [ + "type", + "url" + ], + "type": "object" + } + }, + "properties": { + "body": { + "$ref": "#/definitions/ContentTree.transit.Body" + }, + "data": {}, + "type": { + "const": "root", + "type": "string" + } + }, + "propertyOrder": [ + "type", + "body", + "data" + ], + "required": [ + "body", + "type" + ], + "type": "object" +} + diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index cfd9bc7..f9f91cb 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -287,17 +287,19 @@ }, "maxItems": 10, "minItems": 4, - "sparkRepeater": true, "type": "array" }, "data": {}, - "heading": { - "$ref": "#/definitions/ContentTree.transit.CarouselHeading" - }, "id": { "description": "unique identifier required for component tracking", "type": "string" }, + "standfirst": { + "type": "string" + }, + "title": { + "type": "string" + }, "type": { "const": "carousel", "type": "string" @@ -308,7 +310,6 @@ "id", "type" ], - "sparkGenerateStoryblock": true, "type": "object" }, "ContentTree.transit.CarouselCard": { @@ -356,27 +357,6 @@ ], "type": "object" }, - "ContentTree.transit.CarouselHeading": { - "additionalProperties": false, - "properties": { - "data": {}, - "standfirst": { - "type": "string" - }, - "title": { - "type": "string" - }, - "type": { - "const": "carousel-heading", - "type": "string" - } - }, - "required": [ - "title", - "type" - ], - "type": "object" - }, "ContentTree.transit.ClipSet": { "additionalProperties": false, "properties": { diff --git a/test.bash b/test.bash index 6a1bffc..c330dbf 100755 --- a/test.bash +++ b/test.bash @@ -7,9 +7,16 @@ AJV_CUSTOM_KEYWORDS=./tests/schema/ajv-custom-keywords.js for schema in body-tree content-tree transit-tree; do for datafile in tests/schema/"$schema"/valid/*; do - "$AJV" test --valid --allow-union-types -c "$AJV_CUSTOM_KEYWORDS" -s schemas/"$schema".schema.json -d "$datafile" + "$AJV" test --valid --allow-union-types -s schemas/"$schema".schema.json -d "$datafile" done for datafile in tests/schema/"$schema"/invalid/*; do - "$AJV" test --invalid --allow-union-types -c "$AJV_CUSTOM_KEYWORDS" -s schemas/"$schema".schema.json -d "$datafile" + "$AJV" test --invalid --allow-union-types -s schemas/"$schema".schema.json -d "$datafile" done done + +for datafile in tests/schema/"$schema"/valid/*; do + "$AJV" test --valid --allow-union-types -c "$AJV_CUSTOM_KEYWORDS" -s schemas/spark-transit-tree.schema.json -d "$datafile" +done +for datafile in tests/schema/"$schema"/invalid/*; do + "$AJV" test --invalid --allow-union-types -c "$AJV_CUSTOM_KEYWORDS" -s schemas/spark-transit-tree.schema.json -d "$datafile" +done diff --git a/tests/schema/ajv-custom-keywords.js b/tests/schema/ajv-custom-keywords.js index 8f9ceac..d118779 100644 --- a/tests/schema/ajv-custom-keywords.js +++ b/tests/schema/ajv-custom-keywords.js @@ -7,4 +7,12 @@ module.exports = function addCustomKeywords(ajv) { keyword: "sparkGenerateStoryblock", schemaType: "boolean", }) + ajv.addKeyword({ + keyword: "sparkMapNodeType", + schemaType: "string", + }) + ajv.addKeyword({ + keyword: "propertyOrder", + schemaType: "array", + }) }