From 8c339765f1fd5563048c2efeeeaf98ef619a3306 Mon Sep 17 00:00:00 2001 From: Alex Sanders Date: Thu, 12 Dec 2024 13:11:51 +0000 Subject: [PATCH] update schemas --- .../src/model/article-schema.json | 369 ++++++++++++++++++ dotcom-rendering/src/model/block-schema.json | 250 ++++++++++++ dotcom-rendering/src/model/front-schema.json | 13 + .../src/model/newsletter-page-schema.json | 1 + .../src/model/tag-page-schema.json | 6 + 5 files changed, 639 insertions(+) diff --git a/dotcom-rendering/src/model/article-schema.json b/dotcom-rendering/src/model/article-schema.json index f7bb836e913..1572360541b 100644 --- a/dotcom-rendering/src/model/article-schema.json +++ b/dotcom-rendering/src/model/article-schema.json @@ -119,6 +119,7 @@ } }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -262,6 +263,7 @@ "$ref": "#/definitions/OnwardsSource" }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -434,6 +436,119 @@ }, "isRightToLeftLang": { "type": "boolean" + }, + "crossword": { + "allOf": [ + { + "type": "object", + "properties": { + "creator": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "webUrl": { + "type": "string" + } + }, + "required": [ + "name", + "webUrl" + ] + }, + "crosswordType": { + "enum": [ + "cryptic", + "everyman", + "prize", + "quick", + "quick-cryptic", + "quiptic", + "special", + "speedy", + "weekend" + ], + "type": "string" + }, + "date": { + "type": "number" + }, + "dateSolutionAvailable": { + "type": "number" + }, + "dimensions": { + "type": "object", + "properties": { + "rows": { + "type": "number" + }, + "cols": { + "type": "number" + } + }, + "required": [ + "cols", + "rows" + ] + }, + "entries": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/CAPIEntry" + } + ], + "minItems": 1, + "additionalItems": { + "$ref": "#/definitions/CAPIEntry" + } + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "number": { + "type": "number" + }, + "pdf": { + "type": "string" + }, + "solutionAvailable": { + "type": "boolean" + }, + "webPublicationDate": { + "type": "number" + }, + "instructions": { + "type": "string" + } + }, + "required": [ + "crosswordType", + "date", + "dimensions", + "entries", + "id", + "name", + "number", + "solutionAvailable" + ] + }, + { + "type": "object", + "properties": { + "instructions": { + "type": "string" + } + }, + "required": [ + "instructions" + ] + } + ] } }, "required": [ @@ -762,6 +877,9 @@ }, { "$ref": "#/definitions/WitnessTypeBlockElement" + }, + { + "$ref": "#/definitions/CrosswordElement" } ] }, @@ -3976,6 +4094,253 @@ "witnessEmbedType" ] }, + "CrosswordElement": { + "type": "object", + "properties": { + "_type": { + "type": "string", + "const": "model.dotcomrendering.pageElements.CrosswordElement" + }, + "crossword": { + "allOf": [ + { + "type": "object", + "properties": { + "creator": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "webUrl": { + "type": "string" + } + }, + "required": [ + "name", + "webUrl" + ] + }, + "crosswordType": { + "enum": [ + "cryptic", + "everyman", + "prize", + "quick", + "quick-cryptic", + "quiptic", + "special", + "speedy", + "weekend" + ], + "type": "string" + }, + "date": { + "type": "number" + }, + "dateSolutionAvailable": { + "type": "number" + }, + "dimensions": { + "type": "object", + "properties": { + "rows": { + "type": "number" + }, + "cols": { + "type": "number" + } + }, + "required": [ + "cols", + "rows" + ] + }, + "entries": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/CAPIEntry" + } + ], + "minItems": 1, + "additionalItems": { + "$ref": "#/definitions/CAPIEntry" + } + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "number": { + "type": "number" + }, + "pdf": { + "type": "string" + }, + "solutionAvailable": { + "type": "boolean" + }, + "webPublicationDate": { + "type": "number" + }, + "instructions": { + "type": "string" + } + }, + "required": [ + "crosswordType", + "date", + "dimensions", + "entries", + "id", + "name", + "number", + "solutionAvailable" + ] + }, + { + "type": "object", + "properties": { + "instructions": { + "type": "string" + } + } + } + ] + } + }, + "required": [ + "_type", + "crossword" + ] + }, + "CAPIEntry": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "anyOf": [ + { + "type": "string", + "pattern": "^[0-9]*-across$" + }, + { + "type": "string", + "pattern": "^[0-9]*-down$" + } + ] + }, + "group": { + "type": "array", + "items": [ + { + "anyOf": [ + { + "type": "string", + "pattern": "^[0-9]*-across$" + }, + { + "type": "string", + "pattern": "^[0-9]*-down$" + } + ] + } + ], + "minItems": 1, + "additionalItems": { + "anyOf": [ + { + "type": "string", + "pattern": "^[0-9]*-across$" + }, + { + "type": "string", + "pattern": "^[0-9]*-down$" + } + ] + } + }, + "number": { + "type": "number" + } + }, + "required": [ + "group", + "id", + "number" + ] + }, + { + "type": "object", + "properties": { + "direction": { + "$ref": "#/definitions/Direction" + }, + "position": { + "$ref": "#/definitions/Coords", + "description": "Coords of first cell" + }, + "clue": { + "description": "The clue for the current entry", + "type": "string" + }, + "humanNumber": { + "description": "The number for the clue", + "type": "string" + }, + "solution": { + "description": "The solution to the entry's clue", + "type": "string" + }, + "length": { + "description": "The length of the solution (we don't always have a solution)", + "type": "number" + }, + "separatorLocations": { + "$ref": "#/definitions/Record", + "description": "Separators for multi-part solutions e.g.\n- ready,steady,go\n- tofu-eating" + } + }, + "required": [ + "clue", + "direction", + "humanNumber", + "length", + "position", + "separatorLocations" + ] + } + ] + }, + "Direction": { + "enum": [ + "across", + "down" + ], + "type": "string" + }, + "Coords": { + "type": "object", + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": [ + "x", + "y" + ] + }, + "Record": { + "type": "object" + }, "Block": { "type": "object", "properties": { @@ -4139,6 +4504,7 @@ "type": "string" }, "FEDesign": { + "description": "FEDesign is what frontend gives (originating in the capi scala client) us on the Format field\nhttps://github.com/guardian/content-api-scala-client/blob/master/client/src/main/scala/com.gu.contentapi.client/utils/format/Design.scala", "enum": [ "AnalysisDesign", "ArticleDesign", @@ -4182,6 +4548,7 @@ "type": "string" }, "FEDisplay": { + "description": "FEDisplay is the display information passed through from frontend (originating in the capi scala client) and dictates the display style of the content e.g. Immersive\nhttps://github.com/guardian/content-api-scala-client/blob/master/client/src/main/scala/com.gu.contentapi.client/utils/format/Display.scala", "enum": [ "ImmersiveDisplay", "NumberedListDisplay", @@ -4202,6 +4569,7 @@ "type": "string" }, "FELinkType": { + "description": "Data types for the API request bodies from clients that require transformation before internal use.\nWhere data types are coming from Frontend we try to use the 'FE' prefix.\nPrior to this we used 'CAPI' as a prefix which wasn't entirely accurate, and some data structures never received the prefix, meaning some are still missing it.", "type": "object", "properties": { "url": { @@ -4459,6 +4827,7 @@ "type": "object", "properties": { "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { diff --git a/dotcom-rendering/src/model/block-schema.json b/dotcom-rendering/src/model/block-schema.json index ab6241ca5b4..53e7a6246b8 100644 --- a/dotcom-rendering/src/model/block-schema.json +++ b/dotcom-rendering/src/model/block-schema.json @@ -349,6 +349,9 @@ }, { "$ref": "#/definitions/WitnessTypeBlockElement" + }, + { + "$ref": "#/definitions/CrosswordElement" } ] }, @@ -3563,6 +3566,253 @@ "witnessEmbedType" ] }, + "CrosswordElement": { + "type": "object", + "properties": { + "_type": { + "type": "string", + "const": "model.dotcomrendering.pageElements.CrosswordElement" + }, + "crossword": { + "allOf": [ + { + "type": "object", + "properties": { + "creator": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "webUrl": { + "type": "string" + } + }, + "required": [ + "name", + "webUrl" + ] + }, + "crosswordType": { + "enum": [ + "cryptic", + "everyman", + "prize", + "quick", + "quick-cryptic", + "quiptic", + "special", + "speedy", + "weekend" + ], + "type": "string" + }, + "date": { + "type": "number" + }, + "dateSolutionAvailable": { + "type": "number" + }, + "dimensions": { + "type": "object", + "properties": { + "rows": { + "type": "number" + }, + "cols": { + "type": "number" + } + }, + "required": [ + "cols", + "rows" + ] + }, + "entries": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/CAPIEntry" + } + ], + "minItems": 1, + "additionalItems": { + "$ref": "#/definitions/CAPIEntry" + } + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "number": { + "type": "number" + }, + "pdf": { + "type": "string" + }, + "solutionAvailable": { + "type": "boolean" + }, + "webPublicationDate": { + "type": "number" + }, + "instructions": { + "type": "string" + } + }, + "required": [ + "crosswordType", + "date", + "dimensions", + "entries", + "id", + "name", + "number", + "solutionAvailable" + ] + }, + { + "type": "object", + "properties": { + "instructions": { + "type": "string" + } + } + } + ] + } + }, + "required": [ + "_type", + "crossword" + ] + }, + "CAPIEntry": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "anyOf": [ + { + "type": "string", + "pattern": "^[0-9]*-across$" + }, + { + "type": "string", + "pattern": "^[0-9]*-down$" + } + ] + }, + "group": { + "type": "array", + "items": [ + { + "anyOf": [ + { + "type": "string", + "pattern": "^[0-9]*-across$" + }, + { + "type": "string", + "pattern": "^[0-9]*-down$" + } + ] + } + ], + "minItems": 1, + "additionalItems": { + "anyOf": [ + { + "type": "string", + "pattern": "^[0-9]*-across$" + }, + { + "type": "string", + "pattern": "^[0-9]*-down$" + } + ] + } + }, + "number": { + "type": "number" + } + }, + "required": [ + "group", + "id", + "number" + ] + }, + { + "type": "object", + "properties": { + "direction": { + "$ref": "#/definitions/Direction" + }, + "position": { + "$ref": "#/definitions/Coords", + "description": "Coords of first cell" + }, + "clue": { + "description": "The clue for the current entry", + "type": "string" + }, + "humanNumber": { + "description": "The number for the clue", + "type": "string" + }, + "solution": { + "description": "The solution to the entry's clue", + "type": "string" + }, + "length": { + "description": "The length of the solution (we don't always have a solution)", + "type": "number" + }, + "separatorLocations": { + "$ref": "#/definitions/Record", + "description": "Separators for multi-part solutions e.g.\n- ready,steady,go\n- tofu-eating" + } + }, + "required": [ + "clue", + "direction", + "humanNumber", + "length", + "position", + "separatorLocations" + ] + } + ] + }, + "Direction": { + "enum": [ + "across", + "down" + ], + "type": "string" + }, + "Coords": { + "type": "object", + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": [ + "x", + "y" + ] + }, + "Record": { + "type": "object" + }, "Attributes": { "type": "object", "properties": { diff --git a/dotcom-rendering/src/model/front-schema.json b/dotcom-rendering/src/model/front-schema.json index 1b08fa3f4b6..4abceb81996 100644 --- a/dotcom-rendering/src/model/front-schema.json +++ b/dotcom-rendering/src/model/front-schema.json @@ -617,6 +617,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -1090,6 +1091,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -1178,6 +1180,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -1365,6 +1368,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -1838,6 +1842,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -1926,6 +1931,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -2113,6 +2119,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -2586,6 +2593,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -2674,6 +2682,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -3036,6 +3045,7 @@ ] }, "FEDesign": { + "description": "FEDesign is what frontend gives (originating in the capi scala client) us on the Format field\nhttps://github.com/guardian/content-api-scala-client/blob/master/client/src/main/scala/com.gu.contentapi.client/utils/format/Design.scala", "enum": [ "AnalysisDesign", "ArticleDesign", @@ -3079,6 +3089,7 @@ "type": "string" }, "FEDisplay": { + "description": "FEDisplay is the display information passed through from frontend (originating in the capi scala client) and dictates the display style of the content e.g. Immersive\nhttps://github.com/guardian/content-api-scala-client/blob/master/client/src/main/scala/com.gu.contentapi.client/utils/format/Display.scala", "enum": [ "ImmersiveDisplay", "NumberedListDisplay", @@ -3393,6 +3404,7 @@ ] }, "FELinkType": { + "description": "Data types for the API request bodies from clients that require transformation before internal use.\nWhere data types are coming from Frontend we try to use the 'FE' prefix.\nPrior to this we used 'CAPI' as a prefix which wasn't entirely accurate, and some data structures never received the prefix, meaning some are still missing it.", "type": "object", "properties": { "url": { @@ -3558,6 +3570,7 @@ "type": "object", "properties": { "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { diff --git a/dotcom-rendering/src/model/newsletter-page-schema.json b/dotcom-rendering/src/model/newsletter-page-schema.json index 9ed29434550..bc4cc4df9e1 100644 --- a/dotcom-rendering/src/model/newsletter-page-schema.json +++ b/dotcom-rendering/src/model/newsletter-page-schema.json @@ -291,6 +291,7 @@ ] }, "FELinkType": { + "description": "Data types for the API request bodies from clients that require transformation before internal use.\nWhere data types are coming from Frontend we try to use the 'FE' prefix.\nPrior to this we used 'CAPI' as a prefix which wasn't entirely accurate, and some data structures never received the prefix, meaning some are still missing it.", "type": "object", "properties": { "url": { diff --git a/dotcom-rendering/src/model/tag-page-schema.json b/dotcom-rendering/src/model/tag-page-schema.json index 610b9414df7..ea1a7dbdc9d 100644 --- a/dotcom-rendering/src/model/tag-page-schema.json +++ b/dotcom-rendering/src/model/tag-page-schema.json @@ -138,6 +138,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -611,6 +612,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -699,6 +701,7 @@ ] }, "format": { + "description": "FEFormat is the stringified version of Format passed through from Frontend.\nIt gets converted to the `@guardian/libs` format on platform", "type": "object", "properties": { "design": { @@ -1275,6 +1278,7 @@ ], "definitions": { "FEDesign": { + "description": "FEDesign is what frontend gives (originating in the capi scala client) us on the Format field\nhttps://github.com/guardian/content-api-scala-client/blob/master/client/src/main/scala/com.gu.contentapi.client/utils/format/Design.scala", "enum": [ "AnalysisDesign", "ArticleDesign", @@ -1318,6 +1322,7 @@ "type": "string" }, "FEDisplay": { + "description": "FEDisplay is the display information passed through from frontend (originating in the capi scala client) and dictates the display style of the content e.g. Immersive\nhttps://github.com/guardian/content-api-scala-client/blob/master/client/src/main/scala/com.gu.contentapi.client/utils/format/Display.scala", "enum": [ "ImmersiveDisplay", "NumberedListDisplay", @@ -1705,6 +1710,7 @@ ] }, "FELinkType": { + "description": "Data types for the API request bodies from clients that require transformation before internal use.\nWhere data types are coming from Frontend we try to use the 'FE' prefix.\nPrior to this we used 'CAPI' as a prefix which wasn't entirely accurate, and some data structures never received the prefix, meaning some are still missing it.", "type": "object", "properties": { "url": {