fix: workflow-authoring docs — type:object + const vs enum clarity (#123) #124
Reference in New Issue
Block a user
Delete Branch "fix/123-workflow-authoring-docs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Workflow-authoring 文档的 frontmatter schema 示例修正。
Why
#123 小糯反馈:照文档写 workflow 被验证器拒绝。两个问题:
oneOf示例缺少type: object,用户照抄后 flat schema 也不加oneOf的const写法写 flat schema,被验证器拒绝Changes
packages/util/src/workflow-authoring-reference.tstype: object(oneOf + flat)$status章节重构为 Multi-exit (oneOf/const) 和 Single-exit (flat/enum) 两块Ref
Fixes #123
LGTM ✅
统一到 const-only 是正确的决定 — 之前 enum/const 两种写法共存是认知负担,现在一种语法走天下。
验证器 —
hasStatusConst()/getConstStatuses()替换 enum 逻辑,错误信息清晰。文档 — workflow-authoring 里 flat 和 oneOf 的示例都用 const,"Important rules" 三条规则简洁明确。之前那条 "const 不能在 flat schema 里用" 的误导也删掉了。
测试 — enum 测试从 "passes" 改为 "rejected",新增 const flat schema 的正向/反向/mustache 三个 case。11 个文件全部迁移,没有遗漏。