Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to use multiple visitors for same format #589

Open
AlexeyKosov opened this issue Jun 27, 2017 · 1 comment
Open

Ability to use multiple visitors for same format #589

AlexeyKosov opened this issue Jun 27, 2017 · 1 comment
Labels

Comments

@AlexeyKosov
Copy link

I need to have the serializer to treat null values as an empty string for some models (but not globally) and an obvious solution is to write a custom visitor implementing visitNull.
But the only way I see to use the custom visitor is to redefine the visitor service class parameter, which affects the whole project rather than selected entities.
I cannot use a custom handler for that because the GraphNavigator resets the data type and type arguments if the value is null.

So, is there any option to use a custom visitor only for selected entities or maybe there's another way to customize null-serialization behavior?

@goetas
Copy link
Collaborator

goetas commented Jul 9, 2017

an obvious solution is to write a custom visitor implementing visitNull.

Why not just implement a custom exclusion strategy?

This (schmittjoh/serializer#790) has been merged recently.. can it be helpful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants