Skip to content

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

@xuyushun441-sys

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions