Skip to content

Add top-level SystemSpec discriminated union model #59

@jc-macdonald

Description

@jc-macdonald

Summary

Add a top-level SystemSpec Pydantic model as a discriminated union of ExprSpec and TransitionsSpec, giving users a fully typed entry point to compile_spec().

Problem

After #20–28 create Pydantic models for every sub-structure (Axis, Transition, Mixing, etc.), nothing composes them into a top-level schema. compile_spec() still accepts dict[str, object] — users get no IDE autocompletion, no schema-level validation, and no clear documentation of the full spec shape.

Scope

  • Define ExprSpec model: state, equations, axes, aliases, kernels, operators, constraints, state_axes, meta
  • Define TransitionsSpec model: state, transitions, axes, aliases, kernels, operators, constraints, state_axes, meta
  • Define SystemSpec = ExprSpec | TransitionsSpec as discriminated union on presence of equations vs transitions
  • Update compile_spec() to accept SystemSpec | dict[str, object] (backward-compatible)
  • Spec kind field becomes optional — discrimination handles it

Notes

This naturally subsumes #41 (infer spec kind from contents): a discriminated union on equations vs transitions keys eliminates the need for an explicit kind field.

Dependencies

Should land after sub-model issues are resolved:

Related

Metadata

Metadata

Assignees

Labels

architectureStructural or design-level changesenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions