Skip to content

add multithreaded warning for validating serializer with varying options #19

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

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _docs/schema/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ The validation can be configured using properties on the converter.
- `OutputFormat` configures the JSON Schema output format to be used. By default, this value is `Flag` (the same as on `EvaluationOptions`).
- `RequireFormatValidation` will validate the `format` keyword when set to true. By default `format` is an annotation.

> The `ValidatingJsonConverter` is a factory that creates individual typed converters and caches them. Be aware, however, that when a typed converter is used, its options are overwritten with the options you've set on the factory. This has a side effect of rendering the typed converter unsafe in multithreaded environments when using varying options. It'll be fine if you always use the same options, however.
{: .prompt-warning }

## Declaring a JSON Schema for a type {#schema-deserialization-attribute-usage}

To declare a JSON Schema for any type, it needs to be decorated with the `[JsonSchema()]` attribute.
Expand Down