-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Block object attributes may have custom types with subfields #223
Conversation
🦋 Changeset detectedLatest commit: cb7bbe9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
754cc0a
to
cb7bbe9
Compare
Some of the public docs are indeed a mess. ICYMI here's the docs for block.json metadata and attributes. If there's something specific you're trying to verify I'm happy to help try and dig it out of the source code. |
Hey @mrclay thanks for the PR. I read the docs and it mentions:
Do we need to check with |
I think defining properties without a source is just undefined in WP and we should get their team to bless and document this approach before moving forward. This PR would add API surface area that may conflict with some other approach they choose in the future. |
Hey @mrclay. Thank you for the PR. Before we review it we require a CLA agreement from you: Contributor License AgreementAll external contributors to WP Engine products must have a signed Contributor License Agreement (CLA) in place before the contribution may be accepted into any WP Engine codebase.
|
Hi @mrclay, thank you for the PR! I’m not entirely sure if extending this to check for "properties" within "type": "object" is the best approach. From my understanding, the block.json attributes aren't designed to follow a strict JSONSchema format or adhere to its rules. When "type": "object" is used, it primarily acts as a placeholder for any unstructured data type, which may or may not map to a valid query type—it could even represent jargon or binary data. Would it be possible for you to keep this as a patch for now? |
If a block attribute has a "properties" key, the attribute now has a custom type with typed subfields.
Fixes #222
Obviously a big concern here is that, to my knowledge, WP haven't documented how object attribute properties should be documented in block.json. "properties" was chosen by convention in JSONSchema.