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

JsonPatchDocument converter doesn't respect other converters added to JsonSerializerOptions #24

Open
hell-racer opened this issue Sep 4, 2023 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@hell-racer
Copy link

hell-racer commented Sep 4, 2023

Hi! We have string converter which trims string values and replaces empty strings with null. When JsonPatchDocumentConverter reads string values (specifically from value fields), it just uses val = reader.GetString(), so it ignores any string converters added to default JsonSerializerOptions. Is it possible to change value reading logic to just val = JsonSerializer.Deserialize<object>(ref reader); instead of this and this switch statements, to allow other converters to process values? Thanks!

@Havunen Havunen added enhancement New feature or request question Further information is requested labels Sep 17, 2023
@hell-racer
Copy link
Author

So, what do you think? :)

@Havunen
Copy link
Owner

Havunen commented Nov 27, 2023

We need to measure how much it affects the performance and make sure it does not create infinite loops, otherwise sounds good to me

@Havunen
Copy link
Owner

Havunen commented Nov 27, 2023

One possibility is to bring this feature in as a new option

@Havunen
Copy link
Owner

Havunen commented Oct 18, 2024

This is challenging because imagine value is enum and the provided json value is string. It would be awesome if it could map that back to enum from the string, but in the operation model this information where the value will finally be used is not available easily

@Havunen
Copy link
Owner

Havunen commented Oct 18, 2024

PR is welcome, if somebody can make this work

@Havunen Havunen added the help wanted Extra attention is needed label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants