Repository navigation
fix(blocks-cli): keep _-prefixed props and $ref recursive types in the CMS schema - #637
Merged
aline-pereira merged 4 commits intoOct 8, 2026
Merged
Conversation
…e CMS form The PLP loader declares `__pagePath` and `__pageUrl` on its Props for the resolver to fill in. They stay out of the admin today only because the schema generator drops every `_`-prefixed prop, which also drops real user data (`__title`, `_id`) and is fixed next. Mark these two `@ignore` so the admin never offers them as editable fields on a PLP loader. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
generate-schema skipped every property whose name starts with `_`. Those
are user data in deco-cx/deco sites, and the Fresh admin edits them:
- `__title` labels a list entry (`@title {{__title}}` on FAQ lists,
PathRules, notification bars, banners) — the label kept rendering
from the saved value but could no longer be edited;
- `_id` on a regulation is a `dynamic-options` picker — without it the
admin cannot choose which regulation a bar or banner shows;
- hidden literal discriminators (`/** @hide true */ __type: "image"`)
the components branch on.
Skip only `__resolveType`, the block-reference discriminator the
framework owns. Also emit `default` next to the `const` of a string
literal, as deco-cx/deco does for all 479 `const`s in a production
/deco/meta: that is what makes the admin write the discriminator into
a new entry.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A recursive prop type (`interface NavigationPillLink { submenu?:
NavigationPillLink[] }`) hit the generator's cycle guard and came out
as `{ type: "object" }`, so the admin edited the submenu as an object
instead of a list of links. deco-cx/deco emits such a type once as a
definition and `$ref`s it from inside the cycle.
When the cycle guard fires, look through the array / `| null` wrapper
it fired on and, for a named object type, emit a `$ref` to
`<file id>@<TypeName>`; the outer occurrence of the type registers that
definition when it finishes. Every pass now shares one definitions
sink, including site and app loaders, which had no context before.
Anonymous and generic types keep the old `{ type: "object" }` fallback.
Also ignore a JSDoc tag written with a colon (`@description: text`).
deco-cx/deco reads tags with /@(\w+)\s+/, so such a tag never reached
the admin; the TS parser turned it into a description starting with
": ".
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Hidden props were always dropped from `required` so the form could not deadlock on a field the user cannot see. A hidden literal now carries its value as `default` (the admin fills it in), so there is no deadlock to avoid, and deco-cx/deco lists it as required — e.g. the `/** @hide true */ __title: "…"` that keeps a loader's props distinct from its return type. Hidden props without a default stay optional. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
guitavano
approved these changes
Oct 8, 2026
|
🎉 This PR is included in version 7.77.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
generate-schemadrops or collapses props that deco-cx/deco (Fresh) emits, so a migrated site's admin loses fields its production admin has. Found while validating the Oficina Reserva PLP (deco-sites/oficina-tanstack#475) against the Fresh/deco/meta._-prefixed props kept (fix(blocks-cli): keep _-prefixed props). The generator skipped every prop starting with_, so__title(labels of FAQ entries andpathRules) and_id(the regulation picker on notification bars / banners) vanished from the form. Only__resolveTypeis skipped now. String literals also carrydefaultnext toconst, as deco-cx/deco does (all 479consts in the Fresh meta have it).fix(blocks-cli): reference recursive types).interface NavigationPillLink { submenu?: NavigationPillLink[] }hit the cycle guard and became{ type: "object", nullable: true }, so the submenu was edited as an object instead of a list. The cycle now emits a$refto<file id>@<TypeName>, registered by the outer occurrence. Anonymous/generic types keep the old fallback. A JSDoc tag written with a colon (@description: text) is ignored, as deco-cx/deco's/@(\w+)\s+/does, instead of becoming": text".required, matching deco-cx/deco (e.g./** @hide true */ __title: "…").__pagePath/__pageUrlare marked@ignore— they are resolver-injected, and with (1) they would otherwise show up as editable fields on every PLP loader.Evidence
generate-schema.test.ts: 44/44, 6 new tests; 3 of them fail against the current generator.blocks-cliandapps-vtexsuites pass (three subprocess-spawning files can hit the 5 s timeout when run in parallel; 15/15 in isolation). No newtsc/lint errors./deco/meta: 15 differences across 13 types → 0 (FAQList,PathRules,NotificationBarType,Banner/BannerType,Regulation*,ConditionalPageInfoAndSEO, page-not-found Props,RichContentDBProps,NavigationPillLink). The served/deco/metafrom a preview build also diffs to 0, with no dangling$ref.image↔video,FilterToggle) now$refinstead of collapsing, and Sanity_-fields reappear.Not fixed here: #568 (inline FAQ values), auto titles from the type name,
@type.🤖 Generated with Claude Code
Summary by cubic
Fixes
generate-schemaso migrated sites keep fields their production admin has:_-prefixed props were dropped entirely, and recursive types collapsed to a bare object, losing editable data like FAQ labels, regulation pickers, and navigation submenus.__resolveType(the framework's block-reference discriminator) is skipped now;__title,_id, and hidden literal discriminators like__type: "image"are emitted.defaultnext toconst, as deco-cx/deco does, so the admin writes discriminator values into new entries.interface Link { submenu?: Link[] }) emit a$refto a shared definition instead of{ type: "object" }; anonymous and generic types keep the old fallback.required; hidden props without one stay optional.@description: text) is ignored rather than turned into a description starting with ": ".packages/apps-vtexmarks the resolver-injected__pagePath/__pageUrlas@ignoreso they never appear as editable fields.Schema diff against a production
/deco/metaon a migrated site drops from 15 differences across 13 types to 0.Written for commit 6cb3bfa. Summary will update on new commits.