Skip to content

fix(schema): seletor de RequestURLParam e sem "Select from saved" em arrays comuns (#644) - #659

Merged
guitavano merged 2 commits into
mainfrom
fix/schema-request-url-param-and-resolvable-wrap
Oct 9, 2026
Merged

guitavano merged 2 commits into
mainfrom
fix/schema-request-url-param-and-resolvable-wrap

Conversation

@aline-pereira

@aline-pereira aline-pereira commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #644.

O que muda

1. RequestURLParam volta a ter o seletor do deco-cx/deco

  • @decocms/apps-website/functions/requestToParam exporta type RequestURLParam = string e Props { param }.
  • generate-schema: prop anotada como RequestURLParam (opcional ou não) vira { $ref: "#/definitions/<b64(website/functions/requestToParam.ts)>@RequestURLParam", title }, como a Fresh emitia.
  • composeMeta passa a incluir:
    • definitions[<b64>] — o bloco "Get params from request parameters";
    • definitions[<b64>@Props] — param: string (default slug);
    • definitions[<b64>@RequestURLParam] — anyOf [ "Force param" (string), bloco ];
    • manifest.blocks.functions["website/functions/requestToParam.ts"] e schema.root.functions (com inputSchema, como na Fresh).

O runtime já resolvia valores salvos (WELL_KNOWN_TYPES.REQUEST_TO_PARAM); só o admin perdia a opção. A chave da definição do bloco é a mesma da Fresh (d2Vic2l0ZS9mdW5jdGlvbnMvcmVxdWVzdFRvUGFyYW0udHM=).

Diferença intencional: na Fresh param usava format: dynamic-options com website/loaders/options/urlParams.ts, que não existe aqui; fica texto simples (default slug) para o campo não virar um seletor vazio.

2. wrapResolvableProperties só embrulha arrays que um loader pode preencher

Antes, todo array de objetos com mais de 3 campos virava anyOf [Resolvable, inline], criando um modo "Select from saved" que o deco-cx/deco nunca ofereceu (na prod do oficina, 0 props com Resolvable). Agora só arrays de produto (com loaders compatíveis) são embrulhados, e mantêm o seletor de loaders. Referências já salvas continuam resolvendo em runtime; muda só o formulário do admin.

Testes

  • schema.test.ts: bloco functions, @Props e @RequestURLParam presentes; array comum de objetos fica inline.
  • generate-schema.test.ts: slug?: RequestURLParam → $ref para a definição; string comum inalterado.
  • Suítes de blocks e apps-website: mesmas falhas da main (80 linhas idênticas, de ambiente/timeouts), nenhuma nova. generate-schema*.test.ts passam com --testTimeout=180000.
  • blocks-cli typecheck: os mesmos 6 erros pré-existentes da main (testes de migração). Biome: diagnósticos idênticos à main nos arquivos tocados.
  • CHANGELOG: entrada em "Unreleased".

🤖 Generated with Claude Code


Summary by cubic

Restores the deco-cx "Get params from request parameters" selector for RequestURLParam props and stops offering a "Select from saved" mode for plain object arrays.

  • @decocms/apps-website/functions/requestToParam now exports RequestURLParam and its Props; generate-schema points such props at #/definitions/<b64>@RequestURLParam and composeMeta bakes the function block, prop schema, and functions entries into schema and manifest.
  • param stays plain text (default slug) because the deco urlParams options loader has no port here.
  • wrapResolvableProperties only wraps arrays a loader can fill (product arrays); plain arrays of objects with more than 3 fields stay inline, matching deco-cx behavior.
  • Runtime resolution of already-saved requestToParam references is unchanged; only the admin form differs. Sites that typed such props as string can switch back to RequestURLParam to get the picker.

Written for commit 509c79c. Summary will update on new commits.

View guided diff Turn on auto-fix

…bject arrays

Two places where the CMS schema of a TanStack site diverged from what
deco-cx/deco emitted, independent of the sections' code (measured on
oficina-tanstack against production; #644):

- RequestURLParam had no schema and there was no `functions` block. A section
  typed `slug?: RequestURLParam` lost the "Get params from request parameters"
  option in the admin, although the runtime still resolves saved
  `website/functions/requestToParam.ts` values. apps-website now exports the
  type, the generator points such props at a `…@RequestURLParam` definition,
  and composeMeta bakes the function block, its props and the type.

- wrapResolvableProperties wrapped every array of objects with more than three
  fields in `anyOf [Resolvable, inline]`, adding a "Select from saved" mode the
  CMS user never had. It now only wraps arrays with matching loaders (product
  arrays), which keep their picker.

Closes #644
@aline-pereira
aline-pereira requested a review from a team October 9, 2026 03:02
@guitavano
guitavano merged commit b27f0b1 into main Oct 9, 2026
1 check passed
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 7.77.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

tlgimenes added a commit that referenced this pull request Oct 12, 2026
The v8 line never edited CHANGELOG.md, so the squash onto main would
have dropped the two entries main added after the branch point.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

schema: RequestURLParam sem schema (sem bloco functions) e "Select from saved" em todo array de objetos >3 campos — diverge do deco-cx/deco

2 participants