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

Update validator function name in examples to show that value must b… #3327

Merged
merged 2 commits into from Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/3327-michaelrios28.md
@@ -0,0 +1 @@
Changed the validator method name in the [Custom Errors example](https://pydantic-docs.helpmanual.io/usage/models/#custom-errors) to more accurately describe what the validator is doing; changed from `name_must_contain_space` to ` value_must_equal_bar`.
2 changes: 1 addition & 1 deletion docs/examples/models_errors2.py
Expand Up @@ -5,7 +5,7 @@ class Model(BaseModel):
foo: str

@validator('foo')
def name_must_contain_space(cls, v):
def value_must_equal_bar(cls, v):
if v != 'bar':
raise ValueError('value must be "bar"')

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/models_errors3.py
Expand Up @@ -10,7 +10,7 @@ class Model(BaseModel):
foo: str

@validator('foo')
def name_must_contain_space(cls, v):
def value_must_equal_bar(cls, v):
if v != 'bar':
raise NotABarError(wrong_value=v)
return v
Expand Down