You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, is it possible to use multiple matchers in a single custom serializer?
Right now I have this, but I want to add another matcher for datetime fields without disrupting my number matcher:
The matcher is just a function that takes the data and path and returns the transformed data. path_type is a factory function. You can see the implementation here:
I'm open to the idea of an alternative API to provide some syntactic sugar for per type replacers. If you have a suggestion or would like to propose a PR, it'd be appreciated. Otherwise you can achieve your objective with a custom matcher function. I can provide an example at some point later this week.
Thanks @noahnu. So you're suggesting for now I would make it match both types, then filter inside the matcher by type for the different logic? I can work with that for now.
In the long run, I'd suggest matchers which would take an array of the current matcher object. Any that contain matching types should be applied, sequentially if multiple are matched.
Actually, thinking more on this, for my current usecase I think I'd be better off excluding entirely the audit timestamp fields, which I should be able to do with exclude. But I can see how I might need to match different types against different logic in the future.
Hi, is it possible to use multiple matchers in a single custom serializer?
Right now I have this, but I want to add another matcher for
datetime
fields without disrupting my number matcher:I'm not seeing anything about this in the README
The text was updated successfully, but these errors were encountered: