Skip to content

Generate config schema from Effect Schema#26939

Merged
kitlangton merged 2 commits into
devfrom
cleanup/effect-config-schema-script
May 11, 2026
Merged

Generate config schema from Effect Schema#26939
kitlangton merged 2 commits into
devfrom
cleanup/effect-config-schema-script

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Generate the public config.json schema directly from Config.Info with Schema.toJsonSchemaDocument
  • Normalize Effect's optional-field JSON Schema output so editor validation does not allow null values that runtime config parsing rejects
  • Restore the external models.dev $ref for model fields, preserving editor model validation/autocomplete

Compatibility

  • Runtime config parsing is unchanged; this only changes the build-time public JSON Schema generator
  • Generated tui.json is byte-for-byte unchanged
  • Generated config.json now uses standard $defs/$ref instead of inlining repeated schemas, but preserves JSONC flags and model refs
  • Verified generated config.json has no anyOf branches allowing null

Verification

  • bun run script/schema.ts /tmp/config.json /tmp/tui.json
  • diff -u <before-tui.json> <after-tui.json> produced no diff
  • Generated config schema invariants: no nullable optional branches, restored models.dev refs, allowComments, allowTrailingCommas
  • bun typecheck
  • bunx prettier --check script/schema.ts
  • bunx oxlint packages/opencode/script/schema.ts

@kitlangton kitlangton force-pushed the cleanup/effect-config-schema-script branch from 852c389 to e40e063 Compare May 11, 2026 21:53
@kitlangton kitlangton merged commit 59e6967 into dev May 11, 2026
8 of 9 checks passed
@kitlangton kitlangton deleted the cleanup/effect-config-schema-script branch May 11, 2026 23:25
leohenon pushed a commit to leohenon/opencode-vim that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant