We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Allow using typedefof to override options for all instances of a generic type. Example:
typedefof
let options = FSharpJsonOptions() .WithOverrides(fun o -> dict [ typedefof<Result<_, _>>, o.WithUnionTagName("Result") ]) .ToJsonSerializerOptions() JsonSerializer.Serialize((Ok "test": Result<string, string>), o) // --> {"Result":"Ok","Fields":["test"]}
Q: What should happen if a type is matched by both a generic and a specific override? A: Only the specific one is taken into account.
Example:
let options = FSharpJsonOptions() .WithOverrides(fun o -> dict [ typedefof<Result<_, _>>, o.WithUnionTagName("GenericCase") typedof<Result<string, string>>, o.WithUnionTagName("SpecificFields") ]) .ToJsonSerializerOptions() JsonSerializer.Serialize((Ok "test": Result<string, string>), o) // --> {"Case":"Ok","SpecificFields":["test"]}
The text was updated successfully, but these errors were encountered:
[#180] Allow overriding generic types
befd95a
No branches or pull requests
Allow using
typedefof
to override options for all instances of a generic type. Example:Q: What should happen if a type is matched by both a generic and a specific override?
A: Only the specific one is taken into account.
Example:
The text was updated successfully, but these errors were encountered: