Skip to content

Generate the types users write against from a declared schema - #705

Merged
arrry-hydraDB merged 5 commits into
hydra-db:mainfrom
jaywyawhare:feat/schema-codegen
Dec 5, 2026
Merged

arrry-hydraDB merged 5 commits into
hydra-db:mainfrom
jaywyawhare:feat/schema-codegen

Conversation

@jaywyawhare

@jaywyawhare jaywyawhare commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Generate the typed models users write against from a declared schema. selfgraph schema codegen FILE reads schema JSON from a file or stdin and emits importable source in the CLI's SDK language, with typed models and typed create/get helpers that delegate to the existing resources.

Implementation details

Decisions

  • selfgraph schema codegen FILE reads schema JSON from a file or stdin and emits importable source in the CLI's SDK language.
  • Python emits dataclasses and typed dictionaries; TypeScript emits interfaces and property types; both include inherited entity properties.
  • Generated async create and get helpers delegate to the existing resources and validate declared properties.
  • Golden tests pin both outputs, and the conformance pair checks matching validation behavior.

Validation

  • Four new tests fail on base; the conformance pair is updated.
  • scripts/precheck.py passes (733 changed lines, clean trial merge). Full suites on Kuzu pass.
  • Ruff, TypeScript lint, typecheck, and build pass.

Limits

Generated helpers cover async create and get; relation endpoints use string IDs.

Linked issue

Closes #663

AI Assistance

AI tools helped write and test parts of this. I reviewed and ran every change.

Checklist

  • Implements an issue a maintainer has /approved.
  • Small and scoped to that issue.
  • New errors have a code and hint, the same on API, CLI, and MCP in both SDKs (see AGENTS.md). No new codes.
  • Breaking changes described below, or none.

Breaking changes

None.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@arrry-hydraDB arrry-hydraDB added feature New capability area: schema schema, ids, normalization, resolution effort: L Design change or many modules labels Dec 4, 2026
@arrry-hydraDB
arrry-hydraDB marked this pull request as ready for review December 4, 2026 22:29

@arrry-hydraDB arrry-hydraDB left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arrry-hydraDB
arrry-hydraDB merged commit 0f9fb95 into hydra-db:main Dec 5, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: schema schema, ids, normalization, resolution effort: L Design change or many modules feature New capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate the types users write against from a declared schema

2 participants