Skip to content

Add metamodel interfaces for ObjectQL/ObjectUI contract#1

Merged
huangyiirene merged 2 commits intomainfrom
copilot/create-meta-model-interfaces
Jan 18, 2026
Merged

Add metamodel interfaces for ObjectQL/ObjectUI contract#1
huangyiirene merged 2 commits intomainfrom
copilot/create-meta-model-interfaces

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 18, 2026

Defines the type system shared between backend (ObjectQL) parser and frontend (ObjectUI) renderer.

Core Interfaces

FieldType - 16 data types covering text, numeric, date/time, lookup, selection, and special fields (file, image, json)

ObjectField - Field metadata with validation rules, constraints, lookup configuration, and display properties

ObjectEntity - Complete entity definition including fields array, keys, UI hints, audit/soft-delete flags, and search configuration

ObjectView - View configuration supporting 10 presentation types (list, form, detail, card, kanban, calendar, chart, map, timeline, custom) with columns, filters, sorting, and layouts

Usage Example

import { ObjectEntity } from '@objectstack/spec';

const userEntity: ObjectEntity = {
  name: 'User',
  label: 'User',
  pluralLabel: 'Users',
  fields: [
    { name: 'email', label: 'Email', type: 'email', required: true, unique: true },
    { name: 'role', label: 'Role', type: 'select', options: [
      { value: 'admin', label: 'Administrator' },
      { value: 'user', label: 'User' }
    ]},
    { name: 'manager', label: 'Manager', type: 'lookup', 
      lookupEntity: 'User', lookupDisplayField: 'name' }
  ],
  primaryKey: 'id',
  displayField: 'email'
};

Implementation Notes

  • TSDoc comments on all properties for IntelliSense
  • Extensibility via metadata fields without core schema changes
  • Pure TypeScript, platform-agnostic (Node.js/Browser/Electron compatible)
  • Type guard isFieldType() for runtime validation
Original prompt

Please create a src/types/meta directory.
Define the Metamodel interfaces: ObjectEntity, ObjectField, and ObjectView.
These interfaces will be the contract shared between the backend (ObjectQL) parser and the frontend (ObjectUI) renderer.
Include specific types for FieldType (e.g., text, number, lookup)."


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Metamodel interfaces for backend and frontend Add metamodel interfaces for ObjectQL/ObjectUI contract Jan 18, 2026
Copilot AI requested a review from huangyiirene January 18, 2026 08:50
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.

2 participants