Skip to content

cms: the CP rejects RichText together with any other section (VALIDATION_ERROR), and push cannot say which field failed #348

Description

@JonasJesus42

Found while restoring a page on a live account (see #347 for how it came to need restoring).

The rejection

The content that had been live for weeks — a landingPage whose sections are exactly RichText at $position 0 and ElectroluxServices at $position 1 — cannot be committed back:

POST api/content-platform/manage/{account}/{store}/branches/main/commits
-> 400 {"error":{"code":"VALIDATION_ERROR","message":"Data is not valid, please check your input."}}

Bisected on a scratch entry, same seo and slug each time, only sections.values varying:

sections result
{} (empty) ✓ commit
RichText alone ✓ commit
ElectroluxServices alone ✓ commit
RichText + ElectroluxServices VALIDATION_ERROR
BannerFull + ElectroluxServices + SplitPromo ×2 + ElectroluxServices + ContactChannels (6 sections, no RichText) ✓ commit

So it is not the section count — six commit fine. It is RichText in the presence of any sibling. Both forms of seo (plain scalars, and the $fnType: "switch" locale envelope) behave identically, so the envelope is not the trigger.

The published content type has no constraint that would explain it: landingPage.required is [], sections is {"type": "array", "uniqueItems": false} with no minItems/maxItems, and RichText is in the anyOf whitelist. Diffing the published schema at the version that accepted this content against the current one shows the landingPage content type is byte-identical apart from two newly whitelisted sections.

The part parity can fix

Whatever the platform is doing, the error is unactionable. {"code":"VALIDATION_ERROR","message":"Data is not valid, please check your input."} is the entire body — no path, no field, no offending section. It took ~15 commits against a scratch entry to narrow it to one section key.

push already holds both the payload and the published schema (doctor fetches the content types). It could validate locally before POSTing and name the section and property that fails:

✗ sections[0] RichText: <what is wrong>
  the account would reject this commit — nothing was written

Even a plain JSON-Schema pass over content-types/{ct} would have turned a long bisect into one line. Related: #344 (doctor should compare properties, not just section keys).

Repro

export PARITY_CMS_ACCOUNT=<acct> PARITY_CMS_STORE=<store>
parity cms pull --content-type landingPage --entry <any> --branch <b> --out e.json
# leave one RichText plus any other section in data.sections.values
parity cms push --file e.json --yes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions