Skip to content

Conversation

oguzkocer
Copy link
Contributor

  • Add deserialize_empty_array_or_hashmap helper for WordPress's inconsistent JSON responses
  • Handles cases where empty objects are returned as [] instead of {}
  • Simplifies WpApiDetailsAuthenticationMap implementation

Provides a field-level serde helper to handle WordPress's inconsistent
JSON responses where empty objects are sometimes returned as empty arrays.

Changes:
- Add `deserialize_empty_array_or_hashmap` function in `wp_serde_helper`
- Use dedicated visitor pattern to avoid 'static lifetime constraints
- Add comprehensive unit tests for the new helper
- Simplify `WpApiDetailsAuthenticationMap` to use field annotation instead of custom Deserialize impl
@oguzkocer oguzkocer added this to the 0.2 milestone Sep 10, 2025
@oguzkocer oguzkocer marked this pull request as ready for review September 10, 2025 16:38
@oguzkocer oguzkocer enabled auto-merge (squash) September 10, 2025 16:38
@oguzkocer oguzkocer requested a review from jkmassel September 10, 2025 16:38
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.

Works great!

@oguzkocer oguzkocer merged commit 15d5c46 into trunk Sep 10, 2025
20 checks passed
@oguzkocer oguzkocer deleted the feature/deserialize-empty-array-or-hashmap branch September 10, 2025 18:11
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