8000 correct name of validate_arguments in docs (#1375) · ag-python/pydantic@ec25f60 · GitHub
[go: up one dir, main page]

Skip to content

Commit ec25f60

Browse files
correct name of validate_arguments in docs (pydantic#1375)
* correct naem of validate_arguments in docs * bump * Update docs/usage/validation_decorator.md Co-Authored-By: Stephen Brown II <Stephen.Brown2@gmail.com> * Apply suggestions from code review Co-Authored-By: Stephen Brown II <Stephen.Brown2@gmail.com> Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
1 parent 097762b commit ec25f60

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/usage/mypy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Pydantic models work with [mypy](http://mypy-lang.org/) provided you use the annotation-only version of
1+
*pydantic* models work with [mypy](http://mypy-lang.org/) provided you use the annotation-only version of
22
required fields:
33

44
```py
@@ -44,5 +44,5 @@ See the [pydantic mypy plugin docs](../mypy_plugin.md) for more details.
4444

4545
## Other pydantic interfaces
4646

47-
Pydantic [dataclasses](dataclasses.md) and the [`validate_assignment` decorator](validation_decorator.md)
47+
Pydantic [dataclasses](dataclasses.md) and the [`validate_arguments` decorator](validation_decorator.md)
4848
should also work well with mypy.

docs/usage/validation_decorator.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
The `validate_assignment` decorator allows the arguments passed to a function to be parsed and validated using
1+
The `validate_arguments` decorator allows the arguments passed to a function to be parsed and validated using
22
the function's annotations before the function is called. While under the hood this uses the same approach of model
33
creation and initialisation; it provides an extremely easy way to apply validation to your code with minimal
44
boilerplate.
55

66
!!! info "In Beta"
7-
The `validate_assignment` decorator is in **beta**, it has been added to *pydantic* in **v1.5** on a
7+
The `validate_arguments` decorator is in **beta**, it has been added to *pydantic* in **v1.5** on a
88
**provisional basis**. It may change significantly in future releases and its interface will not be concrete
99
until **v2**. Feedback from the community while it's still provisional would be extremely useful; either comment
1010
on [#1205](https://github.com/samuelcolvin/pydantic/issues/1205) or create a new issue.
@@ -19,7 +19,7 @@ _(This script is complete, it should run "as is")_
1919
## Argument Types
2020

2121
Argument types are inferred from type annotations on the function, arguments without a type decorator are considered
22-
as `Any`. Since `validate_assignment` internally uses a standard `BaseModel`, all types listed in
22+
as `Any`. Since `validate_arguments` internally uses a standard `BaseModel`, all types listed in
2323
[types](types.md) can be validated, including *pydantic* models and [custom types](types.md#custom-data-types).
2424
As with the rest of *pydantic*, types can be coerced by the decorator before they're passed to the actual function:
2525

@@ -34,7 +34,7 @@ A few notes:
3434
* `max` has no type annotation, so will be considered as `Any` by the decorator
3535

3636
Type coercion like this can be extremely helpful but also confusing or not desired,
37-
see [below](#coercion-and-stictness) for a discussion of `validate_assignment`'s limitations in this regard.
37+
see [below](#coercion-and-stictness) for a discussion of `validate_arguments`'s limitations in this regard.
3838

3939
## Function Signatures
4040

@@ -56,7 +56,7 @@ _(This script is complete, it should run "as is")_
5656

5757
## Usage with mypy
5858

59-
The `validate_assignment` decorator should work "out of the box" with [mypy](http://mypy-lang.org/) since it's
59+
The `validate_arguments` decorator should work "out of the box" with [mypy](http://mypy-lang.org/) since it's
6060
defined to return a function with the same signature as the function it decorates. The only limitation is that
6161
since we trick mypy into thinking the function returned by the decorator is the same as the function being
6262
decorated; access to the [raw function](#raw-function) or other attributes will require `type: ignore`.
@@ -73,7 +73,7 @@ _(This script is complete, it should run "as is")_
7373

7474
## Async Functions
7575

76-
`validate_assignment` can also be used on async functions:
76+
`validate_arguments` can also be used on async functions:
7777

7878
```py
7979
{!.tmp_examples/validation_decorator_async.py!}
@@ -83,7 +83,7 @@ _(This script is complete, it should run "as is")_
8383

8484
## Limitations
8585

86-
`validate_assignment` has been released on a provisional basis without all the bells and whistles, which may
86+
`validate_arguments` has been released on a provisional basis without all the bells and whistles, which may
8787
be added later, see [#1205](https://github.com/samuelcolvin/pydantic/issues/1205) for some more discussion of this.
8888

8989
In particular:
@@ -102,21 +102,21 @@ exception by default, or both.
102102
### Coercion and Stictness
103103

104104
*pydantic* currently leans on the side of trying to coerce types rather than raise an error if a type is wrong,
105-
see [model data conversion](models.md#data-conversion) and `validate_assignment` is no different.
105+
see [model data conversion](models.md#data-conversion) and `validate_arguments` is no different.
106106

107107
See [#1098](https://github.com/samuelcolvin/pydantic/issues/1098) and other issues with the "strictness" label
108-
for a discussion of this. If *pydantic* get's a "strict" mode in future, `validate_assignment` will have an option
108+
for a discussion of this. If *pydantic* gets a "strict" mode in future, `validate_arguments` will have an option
109109
to use this, it may even become the default for the decorator.
110110

111111
### Performance
112112

113113
We've made a big effort to make *pydantic* as performant as possible (see [the benchmarks](../benchmarks.md))
114114
and argument inspect and model creation is only performed once when the function is defined, however
115-
there will still be a performance impact to using the `validate_assignment` decorator compared to
115+
there will still be a performance impact to using the `validate_arguments` decorator compared to
116116
calling the raw function.
117117

118118
In many situations this will have little or no noticeable effect, however be aware that
119-
`validate_assignment` is not an equivalent or alternative to function definitions in strongly typed languages,
119+
`validate_arguments` is not an equivalent or alternative to function definitions in strongly typed languages;
120120
it never will be.
121121

122122
### Return Value

0 commit comments

Comments
 (0)
0