From 5b2bcfd73ccd6d48db34364e7555d0a482d319a6 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Mon, 22 Aug 2022 22:00:18 +0100 Subject: [PATCH] correct `copy_on_model_validation` docs (#4420) * correct "copy_on_model_validation" docs, fix #4369 * Update docs/usage/model_config.md * correct docs --- changes/4369-samuelcolvin.md | 1 + docs/usage/model_config.md | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changes/4369-samuelcolvin.md diff --git a/changes/4369-samuelcolvin.md b/changes/4369-samuelcolvin.md new file mode 100644 index 0000000..548711e --- /dev/null +++ b/changes/4369-samuelcolvin.md @@ -0,0 +1 @@ +Update documentation for `copy_on_model_validation` to reflect recent changes diff --git a/docs/usage/model_config.md b/docs/usage/model_config.md index f73f3ff..656cf51 100644 --- a/docs/usage/model_config.md +++ b/docs/usage/model_config.md @@ -112,7 +112,12 @@ not be included in the model schemas. **Note**: this means that attributes on th : whether to treat any underscore non-class var attrs as private, or leave them as is; see [Private model attributes](models.md#private-model-attributes) **`copy_on_model_validation`** -: whether inherited models used as fields should be reconstructed (copied) on validation instead of being kept untouched (default: `True`) +: string literal to control how models instances are processed during validation, +with the following means (see [#4093](https://github.com/pydantic/pydantic/pull/4093) for a full discussion of the changes to this field): + +* `'none'` - models are not copied on validation, they're simply kept "untouched" +* `'shallow'` - models are shallow copied, this is the default +* `'deep'` - models are deep copied **`smart_union`** : whether _pydantic_ should try to check all types inside `Union` to prevent undesired coercion; see [the dedicated section](#smart-union)