fix(js): align block-inserter schema with native-inserter producer#501
Open
jkmassel wants to merge 2 commits into
Open
fix(js): align block-inserter schema with native-inserter producer#501jkmassel wants to merge 2 commits into
jkmassel wants to merge 2 commits into
Conversation
#468 added `iconForeground: getBlockIconForeground(item)` to the block payload, but the schema (added in #467, in trunk) still has `additionalProperties: false` on `BlockType` with no `iconForeground` entry. Trunk doesn't emit the field so trunk CI is fine; this branch carries both pieces and AJV rejects the payload. Mirrors the existing `icon` entry: nullable string.
Resolved AJV in node_modules is 6.12.6 (despite package.json declaring ^8.18.0 — pulled in transitively). AJV 6 surfaces the failing field as `dataPath`; AJV 7+ uses `instancePath`. The helper only read `instancePath`, so error messages came back as `/: should be array` instead of `.patterns[0].blockTypes: should be array`, and the regex matchers in the rejection tests failed to find the field name. Read both, fall back across versions.
XCFramework BuildThis PR's XCFramework is available for testing. Add the following to your .package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/501")Built from de8a1f6 |
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
Two small JS fixes that surfaced from CI on #461 / #481 / downstream stacked PRs.
Schema misses
iconForeground— feat(android): render branded block icons with contrast-aware tinting #468 addediconForegroundto the block payload, but the schema (added in refactor(js): harden native inserter pattern payload shape #467) declaresadditionalProperties: falseonBlockTypewith noiconForegroundentry. Trunk doesn't emit the field yet so trunk CI is fine, but any branch that carries both pieces (e.g. feat(android): add native block inserter #461) fails AJV validation. Adds an entry mirroringicon: nullable string.AJV version drift in error reading —
package.jsondeclaresajv ^8.18.0but the resolved version innode_modulesis6.12.6(pulled in transitively and hoisted). AJV 6 surfaces the failing field path asdataPath; AJV 7+ usesinstancePath. The shape-test helper only readinstancePath, so error messages came back as/: should be arrayinstead of.patterns[0].blockTypes: should be array, and the regex matchers in two rejection tests failed to find the field name. Read both, fall back across versions.Landing this on trunk first lets #461 merge as a clean mechanical replay of already-approved squash commits.
Test plan
npx vitest run src/utils/blocks.test.js— 17/17 passmake lint-js-fix— clean