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

Fixed dictionary item value serialization issue #401

Conversation

tjoubert
Copy link
Contributor

Solved Issue #400
Amended the code to pass ApiClientSerializationOptions to DictionaryValueConverter

…CamelCasePropertyNamesExceptDictionaryContractResolver
…ter and CamelCasePropertyNamesExceptDictionaryContractResolver"

This reverts commit ba917e7.
…CamelCasePropertyNamesExceptDictionaryContractResolver
@tjoubert
Copy link
Contributor Author

@DiscoPYF , @rossmills99 , I have just fixed a test that apparently was expecting the property names of objects that are dictionary item values to remain the same (i.e. DontCamelCaseMe => "DontCamelCaseMe"). See 65705d1
So was this a feature by design? If yes, then maybe what I should do is add a new option to ApiClientSerializationOptions (something like public bool CamelCasePropertyNamesOfDictionaryValues { get; set; }) which will be false by default.
DictionaryValueConverter.WriteJson() will then initialize its local serializer with all the specified options only when CamelCasePropertyNamesOfDictionaryValues = true. What do you think?

@tjoubert tjoubert added the enhancement New feature or request label Aug 2, 2022
@DiscoPYF
Copy link
Collaborator

DiscoPYF commented Aug 5, 2022

@tjoubert Yes, I think it was by design. Basically we wanted the serializer to not touch object passed as bind variables to the Cursor or Transaction API.

Your suggestion makes sense to me at a glance. 👍 It would also give more control to callers whenever they want to camelCase bind variables objects, e.g. when inserting a new document with the cursor API, which isn't possible at the moment unless they modify the serializer or use a JsonProperty attribute.

@tjoubert
Copy link
Contributor Author

tjoubert commented Aug 8, 2022

I've added the option property and called it CamelCasePropertyNamesOfObjectValuesInDictionaries.
It is false by default to maintain backward compatibility with the old default behavior.

@tjoubert
Copy link
Contributor Author

tjoubert commented Aug 8, 2022

@DiscoPYF , can you take another look please? :-)
Thanks

@tjoubert tjoubert merged commit 2f7deae into master Nov 29, 2022
@tjoubert tjoubert deleted the feature-3.8/DE-283-PostCreateViewAsync-LinkProperties-not-serializing-correctly branch November 29, 2022 04:16
@tjoubert tjoubert restored the feature-3.8/DE-283-PostCreateViewAsync-LinkProperties-not-serializing-correctly branch November 30, 2022 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LinkProperties dictionnary items do not serialize properties correctly, when using PostCreateViewAsync
2 participants