Skip to content

Conversation

@oguzkocer
Copy link
Contributor

Addresses a breaking change discovered in #1047: WordPress 6.9 returns post type supports as either bool or array, so we use JsonValue wrapped in PostTypeSupportsValue for flexibility.

@oguzkocer oguzkocer added this to the 0.2 milestone Nov 28, 2025
@oguzkocer oguzkocer requested a review from jkmassel November 28, 2025 20:18
Copy link
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this – can we validate that we have a post_type_supports("editor") method somewhere that just checks for that key to be present? It seems like the actual data is pretty much a black box, so we're really just checking for the key to be part of the dictionary or not.

WordPress 6.9 returns post type supports as either bool or array,
so we use JsonValue wrapped in PostTypeSupportsValue for flexibility.

Changes:
- Add PostTypeSupportsValue type wrapping JsonValue
- Update PostTypeSupportsMap to use Arc<PostTypeSupportsValue>
- Update test assertion to use as_json_bool() method
@oguzkocer oguzkocer force-pushed the fix/post-type-supports-json-value branch from 7f86913 to 3161a4e Compare December 9, 2025 18:17
@oguzkocer oguzkocer enabled auto-merge (squash) December 9, 2025 18:17
@oguzkocer oguzkocer disabled auto-merge December 9, 2025 18:17
Add a `supports` method to `PostTypeSupportsMap` for Rust usage and
a `post_type_supports` free function for FFI clients to check if a
post type supports a specific feature by key presence.

Includes documentation explaining the assumption that key presence
implies support, regardless of the associated value.
@oguzkocer oguzkocer force-pushed the fix/post-type-supports-json-value branch from 3161a4e to bb2ccd9 Compare December 9, 2025 18:19
@oguzkocer
Copy link
Contributor Author

can we validate that we have a post_type_supports("editor") method somewhere that just checks for that key to be present? It seems like the actual data is pretty much a black box, so we're really just checking for the key to be part of the dictionary or not.

@jkmassel This should be addressed in bb2ccd9. Let me know if this works for you or not.

Note that there is some weirdness to this design because we are basically bypassing the possible bool value, so I've added a comment for the assumption.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants