diff --git a/CHANGELOG.md b/CHANGELOG.md index f1340be..b8d3c91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - 完善 API `/api/system/getConf` | Perfect API `/api/system/getConf` - 调整 API `/api/block/transferBlockRef` | Adjust API `/api/block/transferBlockRef` - 调整 API `/api/filetree/listDocsByPath` 的测试用例 | Adjust the test cases of API `/api/filetree/listDocsByPath` +- 调整 API `/api/block/getDocInfo` | Adjust API `/api/block/getDocInfo` ## v0.3.7 / 2024-01-24 diff --git a/node/src/types/kernel/api/block/getDocInfo/response.d.ts b/node/src/types/kernel/api/block/getDocInfo/response.d.ts index 6259166..04f6290 100644 --- a/node/src/types/kernel/api/block/getDocInfo/response.d.ts +++ b/node/src/types/kernel/api/block/getDocInfo/response.d.ts @@ -35,7 +35,11 @@ export interface IResponse { * document information */ export interface IData { - ial: Ial; + /** + * Attribute view reference list + */ + attrViews: IAttrView[]; + ial: Ial; /** * document icon */ @@ -66,6 +70,22 @@ export interface IData { subFileCount: number; } +/** + * Attribute view + */ +export interface IAttrView { + /** + * Attribute view ID + */ + id: string; + /** + * Attribute view name + */ + name: ID; +} + +export type ID = "Untitled"; + /** * Inline Attribute List (IAL) of document block */ diff --git a/node/tests/api/block/getDocInfo.test.ts b/node/tests/api/block/getDocInfo.test.ts index 98e00ac..0802258 100644 --- a/node/tests/api/block/getDocInfo.test.ts +++ b/node/tests/api/block/getDocInfo.test.ts @@ -87,14 +87,14 @@ describe.concurrent(pathname, async () => { payload: { id: context.document, }, - debug: false, + debug: true, }, { name: "id: block", payload: { id: context.block, }, - debug: false, + debug: true, }, ]; cases.forEach(item => { diff --git a/schemas/kernel/api/block/getDocInfo/response.schema.json b/schemas/kernel/api/block/getDocInfo/response.schema.json index 1319307..c53c351 100644 --- a/schemas/kernel/api/block/getDocInfo/response.schema.json +++ b/schemas/kernel/api/block/getDocInfo/response.schema.json @@ -1,7 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/block/getDocInfo/response.schema.json", - "$comment": "v", + "$comment": "v3.0.4", "$ref": "#/$defs/root", "$defs": { "root": { @@ -34,6 +34,7 @@ "type": "object", "additionalProperties": false, "required": [ + "attrViews", "ial", "icon", "id", @@ -44,6 +45,13 @@ "subFileCount" ], "properties": { + "attrViews": { + "type": "array", + "description": "Attribute view reference list", + "items": { + "$ref": "#/$defs/attrView" + } + }, "id": { "type": "string", "description": "block ID", @@ -84,6 +92,45 @@ } } }, + "attrView": { + "title": "IAttrView", + "description": "Attribute view", + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "string", + "description": "Attribute view ID" + }, + "name": { + "type": "string", + "description": "Attribute view name" + } + }, + "oneOf": [ + { + "properties": { + "id": { + "const": "" + }, + "name": { + "const": "Untitled" + } + } + }, + { + "properties": { + "id": { + "pattern": "^\\d{14}-[0-9a-z]{7}$" + } + } + } + ] + }, "ial": { "title": "IAL", "description": "Inline Attribute List (IAL) of document block", diff --git a/schemas/kernel/api/block/getDocInfo/response.schema.json5 b/schemas/kernel/api/block/getDocInfo/response.schema.json5 index a54c1fa..1d726c1 100644 --- a/schemas/kernel/api/block/getDocInfo/response.schema.json5 +++ b/schemas/kernel/api/block/getDocInfo/response.schema.json5 @@ -1,14 +1,14 @@ /** * schemas/kernel/api/block/getDocInfo/response.schema.json5 * 获取文档信息 - * REF: https://github.com/siyuan-note/siyuan/blob/v2.9.9/kernel/api/block.go#L212-L229 + * REF: https://github.com/siyuan-note/siyuan/blob/v3.0.4/kernel/api/block.go#L236-L253 * @pathname: /api/block/getDocInfo - * @version: 2.9.9 + * @version: 3.0.4 */ { $schema: 'https://json-schema.org/draft/2020-12/schema', $id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/block/getDocInfo/response.schema.json5', - $comment: 'v', + $comment: 'v3.0.4', $ref: '#/$defs/root', $defs: { root: { @@ -38,8 +38,16 @@ type: 'object', additionalProperties: false, - required: ['ial', 'icon', 'id', 'name', 'refCount', 'refIDs', 'rootID', 'subFileCount'], + required: ['attrViews', 'ial', 'icon', 'id', 'name', 'refCount', 'refIDs', 'rootID', 'subFileCount'], properties: { + attrViews: { + // 属性视图引用列表 + type: 'array', + description: 'Attribute view reference list', + items: { + $ref: '#/$defs/attrView', + }, + }, id: { // 块 ID type: 'string', @@ -88,6 +96,45 @@ }, }, }, + attrView: { + title: 'IAttrView', + description: 'Attribute view', + + type: 'object', + additionalProperties: false, + required: ['id', 'name'], + properties: { + id: { + // 属性视图 ID + type: 'string', + description: 'Attribute view ID', + }, + name: { + // 属性视图名称 + type: 'string', + description: 'Attribute view name', + }, + }, + oneOf: [ + { + properties: { + id: { + const: '', + }, + name: { + const: 'Untitled', + }, + }, + }, + { + properties: { + id: { + pattern: '^\\d{14}-[0-9a-z]{7}$', + }, + }, + }, + ], + }, ial: { // 文档块的内联属性表 title: 'IAL',