Skip to content

finding(types): objectName is declared REQUIRED on ObjectGanttSchema and ObjectCalendarSchema while both renderers resolve data and staticData FIRST — the documented static-data route cannot be annotated #7313

Description

@yinlianghui

Found while bringing content/docs/plugins/plugin-gantt.mdx and content/docs/plugins/plugin-calendar.mdx under check:doc-snippet-types (objectui#5174 batch 6, PR to follow). Filed unassigned and not fixed there — packages/* source is out of that PR's surface by its dispatch.

This is objectui#7296's shape on two more schemas. That card is scoped to ObjectMapSchema by title and body, so closing it would leave gantt and calendar exactly as they are; hence a separate card rather than a comment. The class is now measured on three of the ObjectQL view schemas.

What

packages/types/src/objectql.ts:

  • ObjectGanttSchema.objectName: string — required
  • ObjectCalendarSchema.objectName: string — required

Both renderers resolve their data configuration by trying objectName last:

packages/plugin-gantt/src/ObjectGantt.tsx, getDataConfig:

if (schema.data)       return schema.data;
if (schema.staticData) return { provider: 'value', items: schema.staticData };
if (schema.objectName) return { provider: 'object', object: schema.objectName };
return null;

packages/plugin-calendar/src/ObjectCalendar.tsx carries the same three branches in the same order (lines 109-127).

So a node with staticData and no objectName — or with an authored data block and no objectName — is a supported, first-class path that the declaration rejects. Every other read of objectName in both components is guarded (if (schema.objectName), schema.objectName ?? '', schema.objectName || …), which is what a genuinely optional key looks like.

Measured

Both pages document the value provider by name and with worked examples:

  • plugin-gantt.mdx — "With Static Data" and "Value Provider (Static)": type: 'object-gantt' + staticData + gantt, no objectName.
  • plugin-gantt.mdx — "API Provider": type: 'object-gantt' + data: { provider: 'api', read: { … } }, no objectName.
  • plugin-calendar.mdx — "With Static Data" and "Value Provider (Static)": same shape with calendar.

Annotating any of them with its own schema type produces TS2741: Property 'objectName' is missing. In the batch-6 PR those blocks therefore ship as plain const declarations with no annotation — they compile and are counted, but their keys are unchecked — rather than deleting documented working behaviour or inventing an objectName the route does not use. They become checked blocks the day the declaration matches the read sites.

Why the type is the half that should move

Both components' data resolution states the precedence in code, and the ledger of authoring routes each page publishes matches it. ObjectGanttSchema already declares staticData?: any[] with the comment "Inline records, wrapped into a { provider: 'value' } config by getDataConfig" — that is the same function whose earlier branch this required key contradicts. The declaration asserts a key the renderer's own documented flow does not need.

The conservative repair is the one objectui#7296 proposes for the map: make objectName optional and let the read sites' existing guards stand. The alternative — a discriminated union per provider — is a bigger authoring-surface decision and is named here only so the ruling is a choice rather than a default.

Related: objectui#7296 (ObjectMapSchema, same shape), objectui#7311 (ObjectCalendarComponentProps.schema, the other calendar declaration gap found in the same pass).

Activity

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

    domain:specobjectui spec stream: fix lands on packages/types, schema corpus or spec pin coupling — spec lanefindingpm:queuepriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions