Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Studio: CEL editor (validate + autocomplete) for field conditional rules (visibleWhen/readonlyWhen/requiredWhen) #1582

Description

@xuyushun441-sys

Context

B2 added field-level conditional rules authored as CEL: visibleWhen / readonlyWhen / requiredWhen (+ deprecated conditionalRequired). Today a low-code author can only type a raw CEL string into the field config — no validation, no field-name help.

Goal

In Studio's metadata-admin field-config form, give each *When property a proper CEL editor:

  • Inline syntax/semantic validation as you type.
  • Field-name autocomplete scoped to the object's fields (and record.* / previous.* / parent.*).
  • Clear error surfacing when a predicate is invalid.

Reuse (don't reimplement)

@objectstack/formula already exports the validators the server uses:

  • validateExpression(...) — parse + semantic check.
  • introspectScope(...) / expectedDialect(...) / CEL_STDLIB_FUNCTIONS.

Wire these into the Studio form widget rather than writing a parallel checker. See the objectstack-studio-admin skill for how metadata types map fields → form widgets and how to register a custom widget per property.

Scope notes

  • objectui-side: packages/app-shell/src/views/metadata-admin/* (field/object config forms).
  • Needs objectui to consume the @objectstack/formula version that exports the validators (already a dep via core).

Acceptance

  • Editing an object field in Studio, the three *When inputs validate live and autocomplete field names.
  • An invalid predicate blocks save (or warns) with a readable message.
  • Round-trips: a rule authored in Studio persists and is honored at runtime (form + grid).

Activity

  1. os-zhuang commented on Jul 16, 2026

    @os-zhuang
    Contributor

    Delivered — closing as completed.

    Round-trip (author → persist → runtime enforcement in form + grid) is the existing B2 path (#1578 / #1579) with its live e2e; the sibling-field catalog reaches the editor via the existing widgetContext.objectFields plumbing.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions