diff --git a/packages/rich-text-types/src/nodeTypes.ts b/packages/rich-text-types/src/nodeTypes.ts index a5a96bd4..8b7e01d6 100644 --- a/packages/rich-text-types/src/nodeTypes.ts +++ b/packages/rich-text-types/src/nodeTypes.ts @@ -198,7 +198,7 @@ export interface ResourceHyperlink extends Inline { } export interface TableCell extends Block { - nodeType: BLOCKS.TABLE_CELL; + nodeType: BLOCKS.TABLE_HEADER_CELL | BLOCKS.TABLE_CELL; data: { colspan?: number; rowspan?: number; @@ -207,20 +207,11 @@ export interface TableCell extends Block { /** * @minItems 1 */ - content: (Paragraph | OrderedList | UnorderedList)[]; + content: Paragraph[]; } -export interface TableHeaderCell extends Block { +export interface TableHeaderCell extends TableCell { nodeType: BLOCKS.TABLE_HEADER_CELL; - data: { - colspan?: number; - rowspan?: number; - }; - - /** - * @minItems 1 - */ - content: Paragraph[]; } // An abstract table row can have both table cell types @@ -232,7 +223,7 @@ export interface TableRow extends Block { /** * @minItems 1 */ - content: (TableCell | TableHeaderCell)[]; + content: TableCell[]; } export interface Table extends Block { diff --git a/packages/rich-text-types/src/schemas/__test__/__snapshots__/schemas.test.ts.snap b/packages/rich-text-types/src/schemas/__test__/__snapshots__/schemas.test.ts.snap index 4fe1b6e5..8245aaab 100644 --- a/packages/rich-text-types/src/schemas/__test__/__snapshots__/schemas.test.ts.snap +++ b/packages/rich-text-types/src/schemas/__test__/__snapshots__/schemas.test.ts.snap @@ -3186,65 +3186,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table 1`] "$ref": "#/definitions/Table", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "BLOCKS": { - "description": "Map of all Contentful block types. Blocks contain inline or block nodes.", - "enum": [ - "document", - "paragraph", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "ordered-list", - "unordered-list", - "list-item", - "hr", - "blockquote", - "embedded-entry-block", - "embedded-asset-block", - "embedded-resource-block", - "table", - "table-row", - "table-cell", - "table-header-cell", - ], - "type": "string", - }, - "Block": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block", - }, - { - "$ref": "#/definitions/Inline", - }, - { - "$ref": "#/definitions/Text", - }, - ], - }, - "type": "array", - }, - "data": { - "$ref": "#/definitions/NodeData", - }, - "nodeType": { - "$ref": "#/definitions/BLOCKS", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, "INLINES": { "description": "Map of all Contentful inline types. Inline contain inline or text nodes.", "enum": [ @@ -3287,85 +3228,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table 1`] ], "type": "object", }, - "ListItem": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItemBlock", - }, - "type": "array", - }, - "data": { - "properties": {}, - "type": "object", - }, - "nodeType": { - "enum": [ - "list-item", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, - "ListItemBlock": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block", - }, - { - "$ref": "#/definitions/Inline", - }, - { - "$ref": "#/definitions/Text", - }, - ], - }, - "type": "array", - }, - "data": { - "$ref": "#/definitions/NodeData", - }, - "nodeType": { - "$ref": "#/definitions/ListItemBlockEnum", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, - "ListItemBlockEnum": { - "enum": [ - "blockquote", - "embedded-asset-block", - "embedded-entry-block", - "embedded-resource-block", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "hr", - "ordered-list", - "paragraph", - "unordered-list", - ], - "type": "string", - }, "Mark": { "additionalProperties": false, "properties": { @@ -3382,33 +3244,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table 1`] "additionalProperties": true, "type": "object", }, - "OrderedList": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItem", - }, - "type": "array", - }, - "data": { - "properties": {}, - "type": "object", - }, - "nodeType": { - "enum": [ - "ordered-list", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, "Paragraph": { "additionalProperties": false, "properties": { @@ -3472,52 +3307,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table 1`] "type": "object", }, "TableCell": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Paragraph", - }, - { - "$ref": "#/definitions/OrderedList", - }, - { - "$ref": "#/definitions/UnorderedList", - }, - ], - }, - "minItems": 1, - "type": "array", - }, - "data": { - "additionalProperties": false, - "properties": { - "colspan": { - "type": "number", - }, - "rowspan": { - "type": "number", - }, - }, - "type": "object", - }, - "nodeType": { - "enum": [ - "table-cell", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, - "TableHeaderCell": { "additionalProperties": false, "properties": { "content": { @@ -3541,6 +3330,7 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table 1`] }, "nodeType": { "enum": [ + "table-cell", "table-header-cell", ], "type": "string", @@ -3558,14 +3348,7 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table 1`] "properties": { "content": { "items": { - "anyOf": [ - { - "$ref": "#/definitions/TableCell", - }, - { - "$ref": "#/definitions/TableHeaderCell", - }, - ], + "$ref": "#/definitions/TableCell", }, "minItems": 1, "type": "array", @@ -3618,33 +3401,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table 1`] ], "type": "object", }, - "UnorderedList": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItem", - }, - "type": "array", - }, - "data": { - "properties": {}, - "type": "object", - }, - "nodeType": { - "enum": [ - "unordered-list", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, }, } `; @@ -3654,65 +3410,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-cell "$ref": "#/definitions/TableCell", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "BLOCKS": { - "description": "Map of all Contentful block types. Blocks contain inline or block nodes.", - "enum": [ - "document", - "paragraph", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "ordered-list", - "unordered-list", - "list-item", - "hr", - "blockquote", - "embedded-entry-block", - "embedded-asset-block", - "embedded-resource-block", - "table", - "table-row", - "table-cell", - "table-header-cell", - ], - "type": "string", - }, - "Block": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block", - }, - { - "$ref": "#/definitions/Inline", - }, - { - "$ref": "#/definitions/Text", - }, - ], - }, - "type": "array", - }, - "data": { - "$ref": "#/definitions/NodeData", - }, - "nodeType": { - "$ref": "#/definitions/BLOCKS", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, "INLINES": { "description": "Map of all Contentful inline types. Inline contain inline or text nodes.", "enum": [ @@ -3755,85 +3452,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-cell ], "type": "object", }, - "ListItem": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItemBlock", - }, - "type": "array", - }, - "data": { - "properties": {}, - "type": "object", - }, - "nodeType": { - "enum": [ - "list-item", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, - "ListItemBlock": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block", - }, - { - "$ref": "#/definitions/Inline", - }, - { - "$ref": "#/definitions/Text", - }, - ], - }, - "type": "array", - }, - "data": { - "$ref": "#/definitions/NodeData", - }, - "nodeType": { - "$ref": "#/definitions/ListItemBlockEnum", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, - "ListItemBlockEnum": { - "enum": [ - "blockquote", - "embedded-asset-block", - "embedded-entry-block", - "embedded-resource-block", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "hr", - "ordered-list", - "paragraph", - "unordered-list", - ], - "type": "string", - }, "Mark": { "additionalProperties": false, "properties": { @@ -3850,33 +3468,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-cell "additionalProperties": true, "type": "object", }, - "OrderedList": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItem", - }, - "type": "array", - }, - "data": { - "properties": {}, - "type": "object", - }, - "nodeType": { - "enum": [ - "ordered-list", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, "Paragraph": { "additionalProperties": false, "properties": { @@ -3916,17 +3507,7 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-cell "properties": { "content": { "items": { - "anyOf": [ - { - "$ref": "#/definitions/Paragraph", - }, - { - "$ref": "#/definitions/OrderedList", - }, - { - "$ref": "#/definitions/UnorderedList", - }, - ], + "$ref": "#/definitions/Paragraph", }, "minItems": 1, "type": "array", @@ -3946,6 +3527,7 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-cell "nodeType": { "enum": [ "table-cell", + "table-header-cell", ], "type": "string", }, @@ -3965,52 +3547,25 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-cell }, "marks": { "items": { - "$ref": "#/definitions/Mark", - }, - "type": "array", - }, - "nodeType": { - "enum": [ - "text", - ], - "type": "string", - }, - "value": { - "type": "string", - }, - }, - "required": [ - "data", - "marks", - "nodeType", - "value", - ], - "type": "object", - }, - "UnorderedList": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItem", + "$ref": "#/definitions/Mark", }, "type": "array", }, - "data": { - "properties": {}, - "type": "object", - }, "nodeType": { "enum": [ - "unordered-list", + "text", ], "type": "string", }, + "value": { + "type": "string", + }, }, "required": [ - "content", "data", + "marks", "nodeType", + "value", ], "type": "object", }, @@ -4190,65 +3745,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-row "$ref": "#/definitions/TableRow", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "BLOCKS": { - "description": "Map of all Contentful block types. Blocks contain inline or block nodes.", - "enum": [ - "document", - "paragraph", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "ordered-list", - "unordered-list", - "list-item", - "hr", - "blockquote", - "embedded-entry-block", - "embedded-asset-block", - "embedded-resource-block", - "table", - "table-row", - "table-cell", - "table-header-cell", - ], - "type": "string", - }, - "Block": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block", - }, - { - "$ref": "#/definitions/Inline", - }, - { - "$ref": "#/definitions/Text", - }, - ], - }, - "type": "array", - }, - "data": { - "$ref": "#/definitions/NodeData", - }, - "nodeType": { - "$ref": "#/definitions/BLOCKS", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, "INLINES": { "description": "Map of all Contentful inline types. Inline contain inline or text nodes.", "enum": [ @@ -4291,85 +3787,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-row ], "type": "object", }, - "ListItem": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItemBlock", - }, - "type": "array", - }, - "data": { - "properties": {}, - "type": "object", - }, - "nodeType": { - "enum": [ - "list-item", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, - "ListItemBlock": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block", - }, - { - "$ref": "#/definitions/Inline", - }, - { - "$ref": "#/definitions/Text", - }, - ], - }, - "type": "array", - }, - "data": { - "$ref": "#/definitions/NodeData", - }, - "nodeType": { - "$ref": "#/definitions/ListItemBlockEnum", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, - "ListItemBlockEnum": { - "enum": [ - "blockquote", - "embedded-asset-block", - "embedded-entry-block", - "embedded-resource-block", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "hr", - "ordered-list", - "paragraph", - "unordered-list", - ], - "type": "string", - }, "Mark": { "additionalProperties": false, "properties": { @@ -4386,33 +3803,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-row "additionalProperties": true, "type": "object", }, - "OrderedList": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItem", - }, - "type": "array", - }, - "data": { - "properties": {}, - "type": "object", - }, - "nodeType": { - "enum": [ - "ordered-list", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, "Paragraph": { "additionalProperties": false, "properties": { @@ -4448,52 +3838,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-row "type": "object", }, "TableCell": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Paragraph", - }, - { - "$ref": "#/definitions/OrderedList", - }, - { - "$ref": "#/definitions/UnorderedList", - }, - ], - }, - "minItems": 1, - "type": "array", - }, - "data": { - "additionalProperties": false, - "properties": { - "colspan": { - "type": "number", - }, - "rowspan": { - "type": "number", - }, - }, - "type": "object", - }, - "nodeType": { - "enum": [ - "table-cell", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, - "TableHeaderCell": { "additionalProperties": false, "properties": { "content": { @@ -4517,6 +3861,7 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-row }, "nodeType": { "enum": [ + "table-cell", "table-header-cell", ], "type": "string", @@ -4534,14 +3879,7 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-row "properties": { "content": { "items": { - "anyOf": [ - { - "$ref": "#/definitions/TableCell", - }, - { - "$ref": "#/definitions/TableHeaderCell", - }, - ], + "$ref": "#/definitions/TableCell", }, "minItems": 1, "type": "array", @@ -4594,33 +3932,6 @@ exports[`getSchemaWithNodeType returns json schema for each nodeType: table-row ], "type": "object", }, - "UnorderedList": { - "additionalProperties": false, - "properties": { - "content": { - "items": { - "$ref": "#/definitions/ListItem", - }, - "type": "array", - }, - "data": { - "properties": {}, - "type": "object", - }, - "nodeType": { - "enum": [ - "unordered-list", - ], - "type": "string", - }, - }, - "required": [ - "content", - "data", - "nodeType", - ], - "type": "object", - }, }, } `; diff --git a/packages/rich-text-types/src/schemas/generated/table-cell.json b/packages/rich-text-types/src/schemas/generated/table-cell.json index f70f4bc4..c58070e5 100644 --- a/packages/rich-text-types/src/schemas/generated/table-cell.json +++ b/packages/rich-text-types/src/schemas/generated/table-cell.json @@ -5,10 +5,11 @@ "type": "object", "properties": { "nodeType": { - "type": "string", "enum": [ - "table-cell" - ] + "table-cell", + "table-header-cell" + ], + "type": "string" }, "data": { "type": "object", @@ -26,17 +27,7 @@ "minItems": 1, "type": "array", "items": { - "anyOf": [ - { - "$ref": "#/definitions/Paragraph" - }, - { - "$ref": "#/definitions/OrderedList" - }, - { - "$ref": "#/definitions/UnorderedList" - } - ] + "$ref": "#/definitions/Paragraph" } } }, @@ -168,198 +159,6 @@ "NodeData": { "additionalProperties": true, "type": "object" - }, - "OrderedList": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "ordered-list" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItem" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItem": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "list-item" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItemBlock" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItemBlock": { - "type": "object", - "properties": { - "nodeType": { - "$ref": "#/definitions/ListItemBlockEnum" - }, - "content": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block" - }, - { - "$ref": "#/definitions/Inline" - }, - { - "$ref": "#/definitions/Text" - } - ] - } - }, - "data": { - "$ref": "#/definitions/NodeData" - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItemBlockEnum": { - "enum": [ - "blockquote", - "embedded-asset-block", - "embedded-entry-block", - "embedded-resource-block", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "hr", - "ordered-list", - "paragraph", - "unordered-list" - ], - "type": "string" - }, - "Block": { - "type": "object", - "properties": { - "nodeType": { - "$ref": "#/definitions/BLOCKS" - }, - "content": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block" - }, - { - "$ref": "#/definitions/Inline" - }, - { - "$ref": "#/definitions/Text" - } - ] - } - }, - "data": { - "$ref": "#/definitions/NodeData" - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "BLOCKS": { - "description": "Map of all Contentful block types. Blocks contain inline or block nodes.", - "type": "string", - "enum": [ - "document", - "paragraph", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "ordered-list", - "unordered-list", - "list-item", - "hr", - "blockquote", - "embedded-entry-block", - "embedded-asset-block", - "embedded-resource-block", - "table", - "table-row", - "table-cell", - "table-header-cell" - ] - }, - "UnorderedList": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "unordered-list" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItem" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] } }, "$schema": "http://json-schema.org/draft-07/schema#" diff --git a/packages/rich-text-types/src/schemas/generated/table-row.json b/packages/rich-text-types/src/schemas/generated/table-row.json index d4a0fe10..98f27854 100644 --- a/packages/rich-text-types/src/schemas/generated/table-row.json +++ b/packages/rich-text-types/src/schemas/generated/table-row.json @@ -18,14 +18,7 @@ "minItems": 1, "type": "array", "items": { - "anyOf": [ - { - "$ref": "#/definitions/TableCell" - }, - { - "$ref": "#/definitions/TableHeaderCell" - } - ] + "$ref": "#/definitions/TableCell" } } }, @@ -40,10 +33,11 @@ "type": "object", "properties": { "nodeType": { - "type": "string", "enum": [ - "table-cell" - ] + "table-cell", + "table-header-cell" + ], + "type": "string" }, "data": { "type": "object", @@ -61,17 +55,7 @@ "minItems": 1, "type": "array", "items": { - "anyOf": [ - { - "$ref": "#/definitions/Paragraph" - }, - { - "$ref": "#/definitions/OrderedList" - }, - { - "$ref": "#/definitions/UnorderedList" - } - ] + "$ref": "#/definitions/Paragraph" } } }, @@ -203,234 +187,6 @@ "NodeData": { "additionalProperties": true, "type": "object" - }, - "OrderedList": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "ordered-list" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItem" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItem": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "list-item" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItemBlock" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItemBlock": { - "type": "object", - "properties": { - "nodeType": { - "$ref": "#/definitions/ListItemBlockEnum" - }, - "content": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block" - }, - { - "$ref": "#/definitions/Inline" - }, - { - "$ref": "#/definitions/Text" - } - ] - } - }, - "data": { - "$ref": "#/definitions/NodeData" - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItemBlockEnum": { - "enum": [ - "blockquote", - "embedded-asset-block", - "embedded-entry-block", - "embedded-resource-block", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "hr", - "ordered-list", - "paragraph", - "unordered-list" - ], - "type": "string" - }, - "Block": { - "type": "object", - "properties": { - "nodeType": { - "$ref": "#/definitions/BLOCKS" - }, - "content": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block" - }, - { - "$ref": "#/definitions/Inline" - }, - { - "$ref": "#/definitions/Text" - } - ] - } - }, - "data": { - "$ref": "#/definitions/NodeData" - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "BLOCKS": { - "description": "Map of all Contentful block types. Blocks contain inline or block nodes.", - "type": "string", - "enum": [ - "document", - "paragraph", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "ordered-list", - "unordered-list", - "list-item", - "hr", - "blockquote", - "embedded-entry-block", - "embedded-asset-block", - "embedded-resource-block", - "table", - "table-row", - "table-cell", - "table-header-cell" - ] - }, - "UnorderedList": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "unordered-list" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItem" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "TableHeaderCell": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "table-header-cell" - ] - }, - "data": { - "type": "object", - "properties": { - "colspan": { - "type": "number" - }, - "rowspan": { - "type": "number" - } - }, - "additionalProperties": false - }, - "content": { - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/definitions/Paragraph" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] } }, "$schema": "http://json-schema.org/draft-07/schema#" diff --git a/packages/rich-text-types/src/schemas/generated/table.json b/packages/rich-text-types/src/schemas/generated/table.json index e9fa82a5..9fa8def8 100644 --- a/packages/rich-text-types/src/schemas/generated/table.json +++ b/packages/rich-text-types/src/schemas/generated/table.json @@ -46,14 +46,7 @@ "minItems": 1, "type": "array", "items": { - "anyOf": [ - { - "$ref": "#/definitions/TableCell" - }, - { - "$ref": "#/definitions/TableHeaderCell" - } - ] + "$ref": "#/definitions/TableCell" } } }, @@ -68,10 +61,11 @@ "type": "object", "properties": { "nodeType": { - "type": "string", "enum": [ - "table-cell" - ] + "table-cell", + "table-header-cell" + ], + "type": "string" }, "data": { "type": "object", @@ -89,17 +83,7 @@ "minItems": 1, "type": "array", "items": { - "anyOf": [ - { - "$ref": "#/definitions/Paragraph" - }, - { - "$ref": "#/definitions/OrderedList" - }, - { - "$ref": "#/definitions/UnorderedList" - } - ] + "$ref": "#/definitions/Paragraph" } } }, @@ -231,234 +215,6 @@ "NodeData": { "additionalProperties": true, "type": "object" - }, - "OrderedList": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "ordered-list" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItem" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItem": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "list-item" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItemBlock" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItemBlock": { - "type": "object", - "properties": { - "nodeType": { - "$ref": "#/definitions/ListItemBlockEnum" - }, - "content": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block" - }, - { - "$ref": "#/definitions/Inline" - }, - { - "$ref": "#/definitions/Text" - } - ] - } - }, - "data": { - "$ref": "#/definitions/NodeData" - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "ListItemBlockEnum": { - "enum": [ - "blockquote", - "embedded-asset-block", - "embedded-entry-block", - "embedded-resource-block", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "hr", - "ordered-list", - "paragraph", - "unordered-list" - ], - "type": "string" - }, - "Block": { - "type": "object", - "properties": { - "nodeType": { - "$ref": "#/definitions/BLOCKS" - }, - "content": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/definitions/Block" - }, - { - "$ref": "#/definitions/Inline" - }, - { - "$ref": "#/definitions/Text" - } - ] - } - }, - "data": { - "$ref": "#/definitions/NodeData" - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "BLOCKS": { - "description": "Map of all Contentful block types. Blocks contain inline or block nodes.", - "type": "string", - "enum": [ - "document", - "paragraph", - "heading-1", - "heading-2", - "heading-3", - "heading-4", - "heading-5", - "heading-6", - "ordered-list", - "unordered-list", - "list-item", - "hr", - "blockquote", - "embedded-entry-block", - "embedded-asset-block", - "embedded-resource-block", - "table", - "table-row", - "table-cell", - "table-header-cell" - ] - }, - "UnorderedList": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "unordered-list" - ] - }, - "data": { - "type": "object", - "properties": {} - }, - "content": { - "type": "array", - "items": { - "$ref": "#/definitions/ListItem" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] - }, - "TableHeaderCell": { - "type": "object", - "properties": { - "nodeType": { - "type": "string", - "enum": [ - "table-header-cell" - ] - }, - "data": { - "type": "object", - "properties": { - "colspan": { - "type": "number" - }, - "rowspan": { - "type": "number" - } - }, - "additionalProperties": false - }, - "content": { - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/definitions/Paragraph" - } - } - }, - "additionalProperties": false, - "required": [ - "content", - "data", - "nodeType" - ] } }, "$schema": "http://json-schema.org/draft-07/schema#"