wp-graphql-content-blocks
wp-graphql-content-blocks copied to clipboard
feat: Block object attributes may have custom types with subfields
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.
🦋 Changeset detected
Latest commit: cb7bbe985a730c8335580e40a90d7f27c0584629
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Name | Type |
---|---|
@wpengine/wp-graphql-content-blocks | Major |
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
to my knowledge, WP haven't documented how object attribute properties should be documented in block.json. "properties" was chosen by convention in JSONSchema.
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:
Note that the validity of an object is determined by your source. For an example, see the query details below.
Do we need to check with isset( $attribute['source']
before we use it or its irrelevant?
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 Agreement
All 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.
- Submit your name and email
- 📝 Sign the CLA emailed to you
- 📥 Receive copy of signed CLA