Skip to content

Commit

Permalink
Replace root_validators with model_validators in v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Franz Wöllert committed Jul 21, 2023
1 parent 998d9d7 commit e5774ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sphinxcontrib/autodoc_pydantic/inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def get_field_validator_mapping(self) -> Dict[str, List[ValidatorAdapter]]:
mapping[field].append(ValidatorAdapter(func=validator.func))

# root validators
for validator in decorators.root_validators.values():
for validator in decorators.model_validators.values():
is_pre = validator.info.mode == "before"
mapping["*"].append(ValidatorAdapter(func=validator.func,
root_pre=is_pre))
Expand Down
2 changes: 1 addition & 1 deletion tests/roots/test-base/target/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def check(cls, v):
"""Check."""
return v

@root_validator(skip_on_failure=True)
@model_validator(mode="after")
def check_root(cls, values):
"""Check root."""
return values
Expand Down

0 comments on commit e5774ce

Please sign in to comment.