bug(whiteboard): whiteboard-cli 把 DSL 转成 OpenAPI 时,带文字的形状被拆成“空形状 + 独立文字节点”(whiteboard-cli 0.2.13)

Abierto
#2,855 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
54/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, node.js
Área
backend, cli

Línea de trabajo

Start by locating the whiteboard-cli code that converts DSL nodes to OpenAPI nodes; the issue provides a minimal JSON input and an exact command to reproduce the split. Check how rect and ellipse text is represented in the converter and compare it with the raw shape structure described in the issue. Done means the conversion produces one composite_shape with its text inline, or adds a documented option for that output.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug domain/core domain/doc domain/whiteboard
问题描述

用 DSL 描述一个带 text 的 rect / ellipse,whiteboard-cli --to openapi 生成的节点里,形状(composite_shape)本身没有文字,文字被放进另一个覆盖在形状上的 text_shape。一个带文字的形状因此变成两个对象,节点数翻倍,维护时要同时处理两个对象。

飞书画板本身支持把文字内置在形状里:在画板里手动给形状输入文字,再用 whiteboard +export --output-type raw 导出,得到的是单个 composite_shape,文字在它自己的 text 字段里。所以这不是画板能力的限制,而是转换器的输出方式。

目前没有找到开关可以关闭这一行为:whiteboard-cli --help 列出的全部选项(-i -o -f -t -s -l -F -b -d --check 等)里没有与文字相关的;lark-whiteboard skill 的 DSL schema 中,Shape 的 text 字段说明的也是形状自带文字,与实际输出不一致。

环境
  • lark-cli version 1.0.97
  • @larksuite/whiteboard-cli 0.2.13(npm latest)
  • Node.js v24.19.0
  • macOS 27.0.1 arm64
  • 飞书国内版
最小复现:无需飞书账号

建立 a.json:

{"version":2,"nodes":[
 {"type":"rect","id":"r1","x":0,"y":0,"width":200,"height":80,"text":"plain text",
  "fillColor":"#E8F0FE","borderColor":"#3370FF","borderWidth":2,"borderRadius":8}
]}

执行:

npx -y @larksuite/[email protected] -i a.json --to openapi --format json

data.result.nodes 中得到两个节点(省略无关字段):

o001:1  type=composite_shape  composite_shape.type=round_rect  (无 text 字段)  width=200 height=80
a001:1  type=text_shape       text.text="plain text"            width=200 height=20  (覆盖在形状上)

ellipse、带 textAlign: "left"、带富文本 run 的矩形、以及 frame 内的文字子节点,都是同样的拆分结果。

期望行为

带文字的形状直接输出一个 composite_shape,文字写在它自己的 text 里(与画板导出的形状文字结构一致),不再额外生成覆盖用的 text_shape;或者提供一个选项(例如 --inline-text)让使用者选择。

影响
  • 用 DSL 绘制泳道图、架构图时,每个带文字的节点、每条泳道容器的标题都会多出一个独立对象。
  • 对已经习惯“文字属于形状”的维护方式(形状内编辑文字、整体选中与移动)不友好。
临时绕过

转换后写一个后处理脚本,把每个 text_shape 并回包含它的形状的 text 字段,再用 lark-cli whiteboard +update --input_format raw 写入。需要注意:写入形状文字时,字段要使用画板自己返回的形状文字结构;把云端导出的文字对象(含 theme_text_color_code 等)原样写回会被接口以 field validation failed 拒绝。

补充
  • 与 #2829 同属 whiteboard-cli 0.2.13 的输出问题,但现象不同,没有发现重复 issue。
  • 若这是有意设计(例如为了精确控制文字位置),希望文档中说明,并提供内置文字的写法。
Lenguaje dominante
Go
Estrellas
18.2k
Forks
1.4k
Merge medio
1 d 3 h
PR fusionados (30 d)
18

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de larksuite/cli

Todos los issues de larksuite/cli

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.