fix: unify $status to const-only, drop enum support (#123)
CI / check (pull_request) Successful in 1m43s

- Validator: hasStatusConst/getConstStatuses replace enum checks
- enum in $status is now rejected with clear error message
- All docs/examples/tests migrated from enum to const/oneOf
- bootstrap hello.yaml updated

Fixes #123
This commit is contained in:
2026-06-05 23:31:56 +00:00
parent 1a37928bb9
commit 68079cc003
11 changed files with 116 additions and 104 deletions
@@ -90,23 +90,21 @@ frontmatter:
required: [$status, error]
\`\`\`
**Single-exit (flat schema)** — use \`enum\` (not \`const\`):
**Single-exit (flat schema)** — same syntax, just no \`oneOf\` wrapper:
\`\`\`yaml
frontmatter:
type: object
properties:
$status:
type: string
enum: [done]
$status: { const: "done" }
summary: { type: string }
required: [$status, summary]
\`\`\`
**Important rules:**
- \`type: object\` is **required** at the top level of frontmatter (both flat and oneOf)
- In flat schemas, \`$status\` must use \`enum: [value]\`, NOT \`const: "value"\` — the validator rejects \`const\` outside of \`oneOf\` variants
- In \`oneOf\` schemas, each variant's \`$status\` must use \`const: "value"\`
- \`$status\` always uses \`const: "value"\` — simple and consistent
- \`enum\` is **not supported** for \`$status\` — the validator will reject it
### Custom Fields