Skip to content

Conversation

@oguzkocer
Copy link
Contributor

@oguzkocer oguzkocer commented Nov 28, 2025

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

@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.

@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
@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.

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
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.
Simplify post type supports by using JsonValue directly instead of
the PostTypeSupportsValue wrapper type. Tests now use the supports
method on PostTypeSupportsMap to check feature support.

Changes:
- Change PostTypeSupportsMap.map from HashMap<_, Arc<PostTypeSupportsValue>> to HashMap<_, JsonValue>
- Remove PostTypeSupportsValue struct and its impl block
- Update Rust test to use supports method directly
- Update Kotlin test to use postTypeSupports helper
@oguzkocer oguzkocer force-pushed the fix/post-type-supports-json-value branch from bb2ccd9 to 76f7aa6 Compare December 17, 2025 21:20
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.

2 participants