Skip to content

Unify Template type definitions across frontend and backend #35

@GeneralJerel

Description

@GeneralJerel

Problem

There are three separate Template type definitions that can drift out of sync:

  • UITemplate in apps/agent/src/templates.py (backend)
  • Template interface in apps/app/src/components/template-library/index.tsx (frontend)
  • SeedTemplate in apps/app/src/components/template-library/seed-templates.ts (frontend)

SeedTemplate is missing component_type and component_data fields, so seed templates for charts would need to be cast. Any field added to one type but not the others causes silent mismatches.

Suggested fix

  • Unify Template and SeedTemplate into a single shared frontend type
  • Ensure the frontend type matches the backend UITemplate schema (all optional fields present)
  • Consider a shared schema definition (e.g. Zod on frontend, matching TypedDict on backend)

Files

  • apps/agent/src/templates.py
  • apps/app/src/components/template-library/index.tsx
  • apps/app/src/components/template-library/seed-templates.ts

From PR #20 review

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions