Open uriyyo opened 1 week ago
please review
Attention: Patch coverage is 94.44444%
with 2 lines
in your changes missing coverage. Please review.
Project coverage is 89.60%. Comparing base (
ab503cb
) to head (5dd9abd
). Report is 230 commits behind head on main.
Files with missing lines | Patch % | Lines |
---|---|---|
src/validators/dict.rs | 87.50% | 1 Missing :warning: |
src/validators/typed_dict.rs | 88.88% | 1 Missing :warning: |
Comparing uriyyo:more-fail-fast
(5dd9abd) with main
(6472887)
✅ 155
untouched benchmarks
After implementing this feature I thought maybe it's make sense to add kinda validation context structure to not duplicate fail-fast check logic, it can look like this:
struct ValidationContext {
fail_fast: bool,
errors: Vec<ValLineError>,
}
impl ValidationContext {
fn new(fail_fast: bool) -> Self {
Self {
fail_fast,
errors: Vec::new(),
}
}
fn default() -> Self {
return Self::new(false);
}
fn should_stop(self) -> bool {
self.fail_fast && self.has_errors()
}
fn has_errors(self) -> bool {
!self.errors.is_empty()
}
fn add_error(mut self, error: ValLineError) {
self.errors.push(error);
}
}
Change Summary
Add fail-fast feature to:
Related issue number
1345
Checklist
pydantic-core
(except for expected changes)