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

Aperta
#2,855 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, node.js
Ambito
backend, cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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。
  • 若这是有意设计(例如为了精确控制文字位置),希望文档中说明,并提供内置文字的写法。
Lingua principale
Go
Stelle
18.2k
Fork
1.4k
Merge medio
1g 3h
PR unite (30g)
18

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di larksuite/cli

Tutte le issue di larksuite/cli

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.