Skip to content

Conversation

@oguzkocer
Copy link
Contributor

Summary

  • Add WpContextualExcludeFromFields attribute to exclude fields from generated field enums
  • Fix integration-tests feature warning in wp_contextual crate

Use Case

Useful for fields like additional_fields that should be included in contextual types but excluded from field filtering enums (e.g., for serde flattened catch-all fields).

Testing Instructions

  1. Add a test field to comments::SparseComment:
    #[WpContext(edit, embed, view)]
    #[WpContextualExcludeFromFields]
    pub test_field: Option<String>,
  2. Run: cargo expand -p wp_api comments > generated_comments.rs
  3. Verify test_field appears in contextual types but NOT in SparseCommentFieldWithEditContext enum

Allow fields to be excluded from generated field enums while still
being included in contextual types. Useful for catch-all fields like
additional_fields that shouldn't be part of field filtering.
Fixes cfg warnings for integration-tests feature used in generated code.
@oguzkocer oguzkocer changed the title Add WpContextualExcludeFromFields attribute Add WpContextualExcludeFromFields attribute Aug 7, 2025
@oguzkocer oguzkocer added the Rust label Aug 7, 2025
@oguzkocer oguzkocer added this to the 0.2 milestone Aug 7, 2025
@crazytonyli crazytonyli merged commit 558fa83 into trunk Aug 8, 2025
20 checks passed
@crazytonyli crazytonyli deleted the feature/wp-contextual-exclude-from-fields branch August 8, 2025 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants