fix: apply same hotfix as #3245 for After pagination field#3248
fix: apply same hotfix as #3245 for After pagination field#3248lemagnetic merged 2 commits intocanary-v2from
Conversation
WalkthroughThis PR updates FastStore CMS JSON schemas: converts pagination cursor Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
pagination field pagination field
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/core/cms/faststore/schema.json`:
- Around line 4308-4315: The "base-page-template" component is defined under
$defs but other page schemas still reference the old location, so update every
$ref that points to "#/components/base-page-template" (or similar) to point to
the new $defs path (e.g. "#/$defs/base-page-template"); ensure the "sections"
property continues to reference "$ref": "#/$defs/$ALLOW_ALL_COMPONENTS" (or the
consistent $defs alias used) and apply this replacement for all content types
that currently extend or $ref the legacy base-page-template so strict $extends
resolvers find the definition.
- Around line 3668-3672: The "after" fields (ProductShelf.after and
ProductTiles.after) are defined as plain strings but are parsed numerically
downstream (maybeAfter via Number(...)), so tighten the JSON Schema to only
accept numeric strings; update both ProductShelf.after and ProductTiles.after to
include a numeric-string guard (e.g., a pattern like "^[0-9]+$" or equivalent)
and keep the existing "default" and description, ensuring invalid non-numeric
values are rejected at validation time rather than becoming NaN in the resolver.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7bcf5d5d-1615-474e-80ab-1d0a87a109d0
📒 Files selected for processing (1)
packages/core/cms/faststore/schema.json
| "after": { | ||
| "type": "integer", | ||
| "type": "string", | ||
| "title": "After", | ||
| "default": 0, | ||
| "default": "0", | ||
| "description": "Initial pagination item" |
There was a problem hiding this comment.
Constrain after to numeric strings.
Line 3669 and Line 3785 switch the field to a plain string, but packages/api/src/platforms/vtex/resolvers/query.ts:190-195 still parses maybeAfter with Number(...) and uses it in pagination math. That means values like "foo" now validate here and only fail downstream as NaN.
Suggested schema guard
"after": {
"type": "string",
"title": "After",
"default": "0",
- "description": "Initial pagination item"
+ "pattern": "^[0-9]+$",
+ "description": "Initial pagination item encoded as a numeric string"
},Apply the same guard to both ProductShelf.after and ProductTiles.after.
Also applies to: 3783-3787
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/core/cms/faststore/schema.json` around lines 3668 - 3672, The
"after" fields (ProductShelf.after and ProductTiles.after) are defined as plain
strings but are parsed numerically downstream (maybeAfter via Number(...)), so
tighten the JSON Schema to only accept numeric strings; update both
ProductShelf.after and ProductTiles.after to include a numeric-string guard
(e.g., a pattern like "^[0-9]+$" or equivalent) and keep the existing "default"
and description, ensuring invalid non-numeric values are rejected at validation
time rather than becoming NaN in the resolver.
| "base-page-template": { | ||
| "type": "object", | ||
| "properties": { | ||
| "sections": { | ||
| "$ref": "#/$defs/$ALLOW_ALL_COMPONENTS" | ||
| } | ||
| } | ||
| }, |
There was a problem hiding this comment.
Point page templates at the new $defs entry.
This shared schema lives under $defs, but the page types above still extend #/components/base-page-template (for example Line 6 and Line 22). As written, this definition is never used, and any strict $extends resolver will keep treating the target as missing.
Minimal fix
- "$extends": ["#/components/base-page-template"],
+ "$extends": ["#/$defs/base-page-template"],Apply that change to every content type that currently extends base-page-template.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/core/cms/faststore/schema.json` around lines 4308 - 4315, The
"base-page-template" component is defined under $defs but other page schemas
still reference the old location, so update every $ref that points to
"#/components/base-page-template" (or similar) to point to the new $defs path
(e.g. "#/$defs/base-page-template"); ensure the "sections" property continues to
reference "$ref": "#/$defs/$ALLOW_ALL_COMPONENTS" (or the consistent $defs alias
used) and apply this replacement for all content types that currently extend or
$ref the legacy base-page-template so strict $extends resolvers find the
definition.
pagination field
What's the purpose of this pull request?
This applies the same hotfix as PR #3245: align the
afterpagination cursor with string type (and related CMS schema updates) so hCMS → Content Platform migrations do not hit type mismatches.References
afterattribute as string instead of integer #3245Summary by CodeRabbit
Bug Fixes
Chores