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

Fail-fast feature #1345

Open
uriyyo opened this issue Jun 25, 2024 · 2 comments
Open

Fail-fast feature #1345

uriyyo opened this issue Jun 25, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@uriyyo
Copy link
Contributor

uriyyo commented Jun 25, 2024

Basic implementation here - #1321

Context:
#1322 (comment)
pydantic/pydantic#9708 (comment)

fail-fast feature might be extended and used not only for sequence types. It might be useful for other types like mappings or models.

I can see that it can be powerful feature when you can from python validator stop validation process by raising an exception.
As was mentioned by @adriangb here - #1322 (comment)

I would like to work on both features if you don't mind.

Please let me know if you have some tips and ideas about implementation!

cc @sydney-runkle @adriangb

@sydney-runkle
Copy link
Member

@uriyyo,

That sounds wonderful. Thanks for your amazing work here.

I like the idea of:

  1. A runtime flag fail_fast that is passed to model_validate
  2. A FailNow data structure that can be used in custom validators
  3. Generally, support for failing early / fast for lots of data types.

Let's confirm with @davidhewitt and @adriangb before moving forwards :).

@sydney-runkle sydney-runkle added enhancement New feature or request and removed unconfirmed labels Jun 25, 2024
@davidhewitt
Copy link
Contributor

Seems fine to me. I'm less sure about the FailNow structure; it might be better to instead pass fail_fast in the info and then let custom validators decide when to fail fast that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants