statig icon indicating copy to clipboard operation
statig copied to clipboard

feat: permit custom state types

Open christianheussy opened this issue 1 year ago • 5 comments

Problem: Currently, the macro does not support user-defined state enums. This limitation is particularly noticeable when users require fine-grained control over Serde serialization/deserialization, specifically when needing to leverage attributes like skip and default.

Solution: Support a custom_state attribute. Permit users to define their own external state type that will be used. Skip generating enum and constructor definitions in this event.

Testing: Implemented an example and added UI test cases.

Issue: https://github.com/mdeloof/statig/issues/43

christianheussy avatar Feb 02 '25 23:02 christianheussy

@mdeloof, here's a first pass. Let me know your initial thoughts!

christianheussy avatar Feb 02 '25 23:02 christianheussy

@christianheussy It's looking good! I'm wondering if we should maybe opt to simply use custom (or maybe manual ) instead of custom_state as it's already a sub-attribute of state?

mdeloof avatar Feb 09 '25 15:02 mdeloof

@christianheussy Are you still able to work on this? If not, is it ok for you if I finish up the work so it can be merged? :)

mdeloof avatar Mar 30 '25 20:03 mdeloof

Yes, will take a look over the weekend!

christianheussy avatar Apr 05 '25 18:04 christianheussy

@mdeloof updated to use custom as the literal. Let me know if you have other suggested changes!

christianheussy avatar Apr 29 '25 16:04 christianheussy

Thanks!

mdeloof avatar May 21 '25 20:05 mdeloof