Commit 2389f4d
Use JsonValue for post type supports field (#1050)
* Use JsonValue for post type supports field
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
* Update Kotlin test to use asJsonBool() for post type supports
* Add post_type_supports helper to check feature support
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.
* Replace PostTypeSupportsValue with JsonValue directly
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
* Add Swift support
---------
Co-authored-by: Jeremy Massel <1123407+jkmassel@users.noreply.github.com>1 parent cf1fe5d commit 2389f4d
File tree
4 files changed
+37
-7
lines changed- native
- kotlin/api/kotlin/src/integrationTest/kotlin
- swift/Sources/wordpress-api
- wp_api_integration_tests/tests
- wp_api/src
4 files changed
+37
-7
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
101 | 123 | | |
102 | 124 | | |
103 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 95 | + | |
99 | 96 | | |
100 | 97 | | |
101 | 98 | | |
| |||
0 commit comments