Skip to content

feat: add JSON Schema export for config validation#4

Merged
Apetuezekiel merged 1 commit into
mainfrom
feat/json-schema-export
May 16, 2026
Merged

feat: add JSON Schema export for config validation#4
Apetuezekiel merged 1 commit into
mainfrom
feat/json-schema-export

Conversation

@Apetuezekiel

Copy link
Copy Markdown
Owner

What

Generates and publishes a JSON Schema (schema/config.schema.json) derived from the ConfigInput TypeScript type, enabling config validation in non-TypeScript runtimes.

Changes:

  • schema/config.schema.json — checked-in JSON Schema (draft-07) for ConfigInput. Covers plans, PlanInput (features, extends, limits), Limit (quota: number | null, period enum), and Period.
  • package.json — adds schema:generate script using ts-json-schema-generator; ts-json-schema-generator added as devDependency. schema/ already in files field from PR 1.
  • .github/workflows/ci.yml — adds "Check schema is up to date" step: regenerates the schema and fails the job with an explanatory message if the committed file differs from the generated output.

Why

Implements v1 scope item 8. The JSON Schema lets non-TypeScript callers (Python services, CLI tools, config validators) validate a tiergraph config at runtime without shipping the TypeScript compiler. The CI drift check prevents the schema from silently going stale when types evolve.

How to verify

# Schema validates correctly against a sample config
npm run schema:generate   # should produce identical output (git diff clean)
cat schema/config.schema.json  # inspect structure

# CI drift check: mutate a type, regenerate, confirm CI would fail
# git diff schema/config.schema.json  # shows diff → CI step would exit 1

Out of scope

  • Full README — PR 5
  • Runtime schema validation helper — not in v1 scope; users wire the schema to their preferred JSON Schema validator

@Apetuezekiel Apetuezekiel merged commit c1847e5 into main May 16, 2026
5 checks passed
@Apetuezekiel Apetuezekiel deleted the feat/json-schema-export branch May 16, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant