Skip to content

examples/hello-world renders four OBJUI-001 panels: schema.json uses PascalCase types (Page/Card/Text/Button) and the registry lookup is case-sensitive #5236

Description

@os-support-ai

Found while measuring the judged-file corpus for #5127 (that card's marker measurement enumerates every in-repo JSON file with a root type). Outside that card's radius, not carried into its branch. Filed unassigned, not claiming.

Symptom

examples/hello-world/schema.json — the smallest example in the repo, the one a newcomer opens first — names every node in PascalCase:

{
"type": "Page",
"title": "Hello ObjectUI",
"children": [
{
"type": "Card",
"children": [
{ "type": "Text", "content": "Welcome to ObjectUI!" },
{ "type": "Text", "content": "This UI is rendered from a JSON schema." },
{ "type": "Button", "content": "Get Started", "variant": "default" }
]
}
]
}

examples/hello-world/App.tsx renders it directly:

import{SchemaRendererProvider,SchemaRenderer}from'@object-ui/react';importschemafrom'./schema.json';// ... SchemaRenderer schema={schema}

None of Page, Card, Text, Button is a registered key. The registered spellings are the lowercase page, card, text, button — all four are present in packages/cli/src/utils/known-schema-types.ts, which is derived from the registration calls themselves (#5115).

Why it does not resolve

packages/core/src/registry/Registry.ts resolves through plain Map lookups — this.components.get(namespacedType) / this.components.get(type) in get(), and the same in has() / getEntry(). There is no toLowerCase anywhere in packages/core/src/registry/, so lookup is case-sensitive and Page misses page. Every node falls through to the OBJUI-001 "Unknown component type" panel.

Independent corroboration from the CLI: objectui check over the repo emits Unknown schema type "Page" in examples/hello-world/schema.json today. It is one of only two real ObjectUI schema files in the whole repo that the command warns about (the other, examples/schema-catalog/src/schemas/core-schema-renderer/unknown-component-type.json, is a deliberate fixture) — so the warning has been on the console output all along, buried under 45 false positives from package.json (that is #5127).

Boundary against #5127

Independent. #5127 is about which files enter type judgement; this is a schema in the repo whose types are wrong whichever way that lands. Under every marker variant considered on #5127 this file stays judged (it carries children), so #5127 neither introduces nor hides it.

Prior art

Same failure shape as the closed #4061 (objectui init scaffolded an app whose registry was empty, so every node rendered "Unknown component type"). That one was fixed at the scaffold; this one is a committed example.

Direction, not prejudged

The obvious fix is to lowercase the four type values in examples/hello-world/schema.json. Worth deciding separately whether the registry should normalise case at lookup — that is a contract question (it would make Page and page the same key everywhere, and PascalCase is what a React-shaped mental model reaches for first), and the answer should not be inferred from this one example. Recommend fixing the example; file the registry-normalisation question on its own if it is wanted.

How to reproduce

With REPO the repository root:

cd "$REPO" && node packages/cli/dist/cli.js check | grep hello-world
grep -rn "toLowerCase" packages/core/src/registry/ # no hits: lookup is case-sensitive

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions