Skip to content

Consume versioned JSON-Schema editor catalog - #2197

Merged
kpal81xd merged 3 commits into
mainfrom
refactor/schema-json-catalog
Aug 18, 2026
Merged

Consume versioned JSON-Schema editor catalog#2197
kpal81xd merged 3 commits into
mainfrom
refactor/schema-json-catalog

Conversation

@kpal81xd

@kpal81xd kpal81xd commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates the schema API to consume a versioned (version: 1) JSON-Schema catalog for asset / scene / settings / component schemas, replacing the previous $-prefixed schema shape. Schema nodes now use standard JSON-Schema keywords (type, properties, items, additionalProperties, enum, default, minItems/maxItems, anyOf for nullability) plus x-editor-type / x-merge-method / x-scope / x-open-map extensions.

Changes

  • editor-api/schema* — read the JSON-Schema catalog shape (type, default, enum, exact length, nullability via anyOf) and map metadata to the x-* extension keys. Schema now fail-fasts on a non-version: 1 payload.
  • Inspector, components menu, templates override panel, clipboard — updated to the new node shape.
  • Fix — AssetsSchema.resolvePath now returns a deep copy of a field's default instead of a live reference into the shared catalog. Previously a consumer that mutated the returned default (e.g. on an unset→set edit) could corrupt the schema default for the rest of the session. This matches the existing behaviour of ComponentSchema.resolvePath.
  • Fix — schema:material:getType falls back to 'string' (with a warning) for an unresolved path instead of returning null, restoring the prior getTypeForPath behaviour, and resolves the path once instead of twice.

Testing

  • npm run test:api — 202/202 passing
  • npm test — 176/176 passing
  • npm run build — clean
  • npm run lint — 0 errors
  • npm run typecheck — no new errors introduced (project baseline unchanged)

The default-aliasing fix and the getType fallback were additionally verified end-to-end in a running editor: the unpatched resolve path shares a reference into the live catalog, the patched wrapper returns an independent copy each call, and mutating the returned default no longer affects the catalog.

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
editor Ready Ready Preview Aug 14, 2026 1:36pm

Request Review

Read the schema catalog as a versioned (version: 1) JSON-Schema tree for
asset/scene/settings/component schemas, replacing the previous $-prefixed
shape. Nodes now use standard JSON-Schema keywords (type, properties, items,
additionalProperties, enum, default, minItems/maxItems, anyOf) plus
x-editor-type / x-merge-method / x-scope / x-open-map extensions.

- editor-api/schema*: read the JSON-Schema shape and map metadata to x-* keys
- inspector, components menu, templates, clipboard: updated to the new shape
- fix: AssetsSchema.resolvePath deep-copies a field's default instead of
  returning a live reference into the shared catalog (matches
  ComponentSchema.resolvePath); prevents catalog corruption via mutation
- fix: schema:material:getType falls back to 'string' (with a warning) for an
  unresolved path instead of returning null
The JSON-Schema catalog refactor dropped @param/@returns/@example on the AssetsSchema, ComponentSchema, SceneSchema and SettingsSchema public methods whose signatures were unchanged. Restore them to match the current signatures. Docs only, no behaviour change.
@kpal81xd
kpal81xd force-pushed the refactor/schema-json-catalog branch from da84e15 to 0737deb Compare August 14, 2026 13:35
@kpal81xd
kpal81xd merged commit 043e502 into main Aug 18, 2026
7 checks passed
@kpal81xd
kpal81xd deleted the refactor/schema-json-catalog branch August 18, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant