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

Possibility to reconfigure the json mapper? #48

Closed
ghost opened this issue Sep 20, 2017 · 4 comments
Closed

Possibility to reconfigure the json mapper? #48

ghost opened this issue Sep 20, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Sep 20, 2017

Hi,

The following line in the ForceApi class is causing us some trouble:
jsonMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

jsonMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

The problem we are having is that when an attribute currently has a value, but then that value was cleared, we receive that new value as "null" from our source system, but it never reaches Salesforce because this null value is ignored by the JSON serialization in ForceApi.

Was there a specific reason why this is the non-changeable default? Would it maybe be a good extension to make this configurable?

We'd be happy to create a pull request for this, were just wondering what the best way might be. Would it be too granular to introduce a boolean option in the configuration that says includeNonNull, with default value true? (In that case the jsonMapper couldn't be a static field anymore, would have to be an instance field that gets initialised in the constructor)

Thanks!

@jesperfj
Copy link
Owner

jesperfj commented Sep 25, 2017

Can you provide a test that demonstrates the behavior you'd like? That'll be the fastest way for me to wrap my head around this. A pull request would be great, even if the implementation is speculative.

@jesperfj
Copy link
Owner

It would be lovely if you can take a look at my proposed changes in #51. This will allow you to use a custom object mapper of your choice. It was primarily designed to fix #45, but it might also help you. However, I really am not sure what will work for erasing field values. I haven't paid attention to that recently.

@ghost
Copy link
Author

ghost commented Sep 26, 2017

It seems like #51 would solve our issue, yes! Perfect.
In that case you can ignore our pull request :-)

Any plans when you are going to release 0.0.38?

@jesperfj
Copy link
Owner

0.0.38 has been released. Please check it out and let me know if things are working as expected.

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

No branches or pull requests

1 participant