Skip to content

Conversation

adriangb
Copy link
Member

@adriangb adriangb commented Jul 14, 2023

Selected Reviewer: @lig

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 43daf05
Status: ✅  Deploy successful!
Preview URL: https://27d9ef2f.pydantic-docs2.pages.dev
Branch Preview URL: https://remove-validate-default-in-d.pydantic-docs2.pages.dev

View logs

@adriangb
Copy link
Member Author

please review

Comment on lines -324 to -330
## Validate always

**TODO this content is wrong!**

For performance reasons, by default validators are not called for fields when a value is not supplied.
However there are situations where it may be useful or required to always call the validator, e.g.
to set a dynamic default value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue it is important to keep the section, but describe behavior instead. You can use validate_defaults to perform validation always...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reality of the matter is that (1) these docs as they currently are do not help and (2) many of the requests we get for this feature either are better solved in another manner or have big drawbacks. We can re-add docs when we find a simple example that this is the right fit for, once we get actual users requesting this that can only be solved by this option, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Valid.

Copy link
Contributor

@lig lig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏻 🤷🏻‍♂️

@adriangb adriangb merged commit d249af9 into main Jul 17, 2023
@adriangb adriangb deleted the remove-validate-default-in-docs branch July 17, 2023 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants