Skip to content

finding(docs): every content/docs/fields page's "Field Schema" block declares its OWN interface, so it compiles vacuously — and the ones measured name keys the exported *FieldMetadata types do not have #6138

Description

@yinlianghui-tw

Observed while implementing #6126 (PR #6137). Filed unassigned, not fixed there — it is a different question from that card's, and it is about a whole family of pages rather than the two.

The shape

Every content/docs/fields/*.mdx reference page opens with a ## Field Schema section whose block declares an interface of its own:

interface AutoNumberFieldSchema {
type: 'auto_number';
name: string;
label?: string;
value?: string | number;
readonly: true;
className?: string;
format?: string;
starting_number?: number;
}

objectui#5867's batches are re-fencing these from plaintext to ts, which is correct — they are TypeScript. But a self-declared interface with no imports is vacuously compilable: it type-checks no matter what it says, because nothing in the block refers to anything the packages export. check-doc-snippet-types reports the page green and structurally cannot see whether the documented shape matches the shipped one.

The divergence, measured on the two pages I had open

@object-ui/types exports the real shapes, and they are sealed — BaseFieldMetadata carries no index signature, which is why an annotated literal in the same page does get excess-checked (proved by ablation in PR #6137).

  • AutoNumberFieldMetadata extends BaseFieldMetadata and adds exactly format? and starting_number?. The documented AutoNumberFieldSchema additionally names value and className, and pins readonly: true where the exported key is readonly?: boolean.
  • ObjectFieldMetadata adds exactly schema?. The documented ObjectFieldSchema additionally names value, disabled and className.

BaseFieldMetadata (packages/types/src/field-types.ts) declares none of value, className or disabled.

Why it may be a conflation rather than a plain error — and why that still needs a ruling

value, className and disabled are plausibly widget props (FieldWidgetComponentProps), not field metadata. If so the pages are documenting a merge of two shapes under a heading that says "Field Schema", which is its own defect: a reader authoring object metadata copies keys that no metadata type accepts, and @objectstack/spec's strict schemas would reject at publish.

Either way the deciding question is what these blocks are for. Two candidate directions, both cheap to state and neither safe to guess:

  • A — annotate against the exported type. Replace the self-declared interface with a literal annotated AutoNumberFieldMetadata (or a satisfies), so the gate actually pins the documented shape to the shipped one. Costs the "here is the full shape at a glance" reading the interface gives.
  • B — keep the interface, add a parity check. A gate that reads each *FieldSchema block and compares its key set with the correspondingly-named exported *FieldMetadata. Keeps the reference-table form and makes the drift visible, at the cost of a new checker.

There are 26 pages under content/docs/fields; only the two above were measured, so the size of the divergence across the rest is unknown and would be the first thing to establish.

Refs: #6126 / PR #6137 (where this surfaced) · #5867 (the re-fencing parent) · #4631 and #6121 (adjacent — declared surfaces that disagree with each other).


Generated by Claude Code

Metadata

Metadata

Labels

documentationImprovements or additions to documentationdomain:devxobjectui devx stream: fix lands on .github/, scripts/ or release pipeline — devx lane cross-repopm:dispatched

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions