Structure Overview
A data report includes the following components in its overall structure:
Headline: The title;Section: Sections used to divide different report topics;
A Section contains multiple Paragraphs, which can be of the following types:
heading1~heading6(note that these are different from the report-level Headline, which specifically refers to the article title);normalfor regular text paragraphs, corresponding to the HTML<p>tag;bulletsfor lists, which can be ordered or unordered, corresponding to HTML<ul>and<ol>tags, supporting multi-level list nesting;customfor custom paragraph types;visualizationfor visualization charts (not currently supported, can be implemented through custom paragraphs);
Besides the standard type containing multiple Paragraphs, Section can also be customized.
Except for custom paragraphs, heading, normal, and bullets are all composed of multiple Phrases, which include the following types:
textfor plain text;entityfor entities, which correspond to specific data content in the data report;customfor custom phrases;
The latest standard JSON Schema definition for T8 is as follows, or fetch from unpkg.com:
json
{
"$ref": "#/definitions/NarrativeTextSpec",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"BulletItemSpec": {
"additionalProperties": false,
"properties": {
"className": {
"type": "string"
},
"key": {
"type": "string"
},
"phrases": {
"items": {
"$ref": "#/definitions/PhraseSpec"
},
"type": "array"
},
"styles": {
"type": "object"
},
"subBullet": {
"$ref": "#/definitions/BulletsParagraphSpec"
},
"type": {
"const": "bullet-item",
"type": "string"
}
},
"required": ["phrases", "type"],
"type": "object"
},
"BulletsParagraphSpec": {
"additionalProperties": false,
"properties": {
"bullets": {
"items": {
"$ref": "#/definitions/BulletItemSpec"
},
"type": "array"
},
"className": {
"type": "string"
},
"isOrder": {
"type": "boolean"
},
"key": {
"type": "string"
},
"styles": {
"type": "object"
},
"type": {
"const": "bullets",
"type": "string"
}
},
"required": ["bullets", "isOrder", "type"],
"type": "object"
},
"CustomBlockElement": {
"description": "basic block element structure, used for extends",
"properties": {
"className": {
"type": "string"
},
"customType": {
"type": "string"
},
"key": {
"type": "string"
},
"styles": {
"type": "object"
}
},
"required": ["customType"],
"type": "object"
},
"CustomMetaData": {
"additionalProperties": {},
"description": "custom phrase metadata",
"properties": {
"customType": {
"type": "string"
}
},
"required": ["customType"],
"type": "object"
},
"CustomPhraseSpec<CustomMetaData>": {
"additionalProperties": false,
"properties": {
"className": {
"type": "string"
},
"key": {
"type": "string"
},
"metadata": {
"$ref": "#/definitions/CustomMetaData"
},
"styles": {
"type": "object"
},
"type": {
"const": "custom",
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["type"],
"type": "object"
},
"EntityMetaData": {
"additionalProperties": false,
"properties": {
"assessment": {
"$ref": "#/definitions/ValueAssessment",
"description": "assessment up or down, used for derived value 衍生指标评估参数,指定上涨或者下跌"
},
"detail": {
"description": "detail data, 明细数据,用于弹框展示"
},
"entityType": {
"$ref": "#/definitions/EntityType",
"description": "entity type, 实体类型标记"
},
"origin": {
"description": "original data, 原始数据",
"type": "number"
},
"sourceId": {
"description": "source id of the variable, to access the variable info from variableSourceMap",
"type": "string"
}
},
"required": ["entityType"],
"type": "object"
},
"EntityPhraseSpec": {
"additionalProperties": false,
"properties": {
"className": {
"type": "string"
},
"key": {
"type": "string"
},
"metadata": {
"$ref": "#/definitions/EntityMetaData"
},
"styles": {
"type": "object"
},
"type": {
"const": "entity",
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["type"],
"type": "object"
},
"EntityType": {
"enum": [
"metric_name",
"metric_value",
"other_metric_value",
"contribute_ratio",
"delta_value",
"ratio_value",
"trend_desc",
"dim_value",
"time_desc",
"proportion"
],
"type": "string"
},
"HeadingParagraphSpec": {
"additionalProperties": false,
"properties": {
"className": {
"type": "string"
},
"key": {
"type": "string"
},
"phrases": {
"items": {
"$ref": "#/definitions/PhraseSpec"
},
"type": "array"
},
"styles": {
"type": "object"
},
"type": {
"enum": ["heading1", "heading2", "heading3", "heading4", "heading5", "heading6"],
"type": "string"
}
},
"required": ["phrases", "type"],
"type": "object"
},
"HeadlineSpec": {
"additionalProperties": false,
"properties": {
"className": {
"type": "string"
},
"key": {
"type": "string"
},
"phrases": {
"items": {
"$ref": "#/definitions/PhraseSpec"
},
"type": "array"
},
"styles": {
"type": "object"
},
"type": {
"const": "headline",
"type": "string"
}
},
"required": ["phrases", "type"],
"type": "object"
},
"NarrativeTextSpec": {
"additionalProperties": false,
"properties": {
"className": {
"type": "string"
},
"headline": {
"$ref": "#/definitions/HeadlineSpec"
},
"key": {
"type": "string"
},
"sections": {
"items": {
"$ref": "#/definitions/SectionSpec"
},
"type": "array"
},
"styles": {
"type": "object"
}
},
"type": "object"
},
"ParagraphSpec": {
"anyOf": [
{
"$ref": "#/definitions/HeadingParagraphSpec"
},
{
"$ref": "#/definitions/TextParagraphSpec"
},
{
"$ref": "#/definitions/BulletsParagraphSpec"
},
{
"$ref": "#/definitions/CustomBlockElement"
}
]
},
"PhraseSpec": {
"anyOf": [
{
"$ref": "#/definitions/TextPhraseSpec"
},
{
"$ref": "#/definitions/EntityPhraseSpec"
},
{
"$ref": "#/definitions/CustomPhraseSpec<CustomMetaData>"
}
]
},
"SectionSpec": {
"anyOf": [
{
"additionalProperties": false,
"properties": {
"className": {
"type": "string"
},
"key": {
"type": "string"
},
"paragraphs": {
"items": {
"$ref": "#/definitions/ParagraphSpec"
},
"type": "array"
},
"styles": {
"type": "object"
}
},
"type": "object"
},
{
"properties": {
"className": {
"type": "string"
},
"customType": {
"type": "string"
},
"key": {
"type": "string"
},
"styles": {
"type": "object"
}
},
"required": ["customType"],
"type": "object"
}
]
},
"TextParagraphSpec": {
"additionalProperties": false,
"properties": {
"className": {
"type": "string"
},
"key": {
"type": "string"
},
"phrases": {
"items": {
"$ref": "#/definitions/PhraseSpec"
},
"type": "array"
},
"styles": {
"type": "object"
},
"type": {
"const": "normal",
"type": "string"
}
},
"required": ["phrases", "type"],
"type": "object"
},
"TextPhraseSpec": {
"additionalProperties": false,
"properties": {
"bold": {
"type": "boolean"
},
"className": {
"type": "string"
},
"italic": {
"type": "boolean"
},
"key": {
"type": "string"
},
"styles": {
"type": "object"
},
"type": {
"const": "text",
"type": "string"
},
"underline": {
"type": "boolean"
},
"url": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["type", "value"],
"type": "object"
},
"ValueAssessment": {
"enum": ["positive", "negative", "equal"],
"type": "string"
}
}
}