-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Improve initialization hooks example #6822
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
Conversation
Deploying with
|
| Latest commit: |
b965ca1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c2808411.pydantic-docs2.pages.dev |
| Branch Preview URL: | https://improve-initialization-hooks.pydantic-docs2.pages.dev |
e9e3fc1 to
15f4a1f
Compare
|
Please review |
15f4a1f to
b014f3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we mention that `post_init`` comes in the "middle" between the validators somewhere?
b014f3d to
48906a9
Compare
There is a line after this code block that says
I've change it to make it more clear |
docs/usage/dataclasses.md
Outdated
| * Before model validator. | ||
| * Before field validator. | ||
| * After field validator. | ||
| * Field type validators. e.g. validation for types like `int`, `str`, ... . | ||
| * `__post_init__`. | ||
| * After model validator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think model_validator(mode='before'), field_validator(mode='before'), etc. notation looks better. 👀
Also, I think we call the "Field type validators" differently in the rest of the documentation? 🤔 Inner validator? I'm not sure...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, look better.
I changed them.
Closes #6806
Selected Reviewer: @samuelcolvin