Skip to content

Adds ability to provide same validator N times#960

Merged
skrawcz merged 2 commits intomainfrom
fix_950
Jun 15, 2024
Merged

Adds ability to provide same validator N times#960
skrawcz merged 2 commits intomainfrom
fix_950

Conversation

@skrawcz
Copy link
Contributor

@skrawcz skrawcz commented Jun 14, 2024

Fixes #950 by allowing multiple validators with the same name.

Changes

  • validators

How I tested this

  • locally via unit tests

Notes

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

Fixes #950. This fixes the case where someone wants to do

```python
@check_output_custom(
CategoricalValuesValidatorPySparkDataFrame(column="ReportingId", allowed_values=[156], importance="fail")),
CategoricalValuesValidatorPySparkDataFrame(column="CategoryID", allowed_values=[1, 2, 3], importance="fail")
)
```
The validator name is the same, but it's used differently. So this
appends a numeric number to make it unique.
@skrawcz skrawcz requested a review from elijahbenizzy June 14, 2024 03:41
Copy link
Contributor

@elijahbenizzy elijahbenizzy left a comment

Choose a reason for hiding this comment

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

Add disclaimer to the docs but otherwise looks good

We cannot stack them, instead you can pass multiple ones in.
@skrawcz skrawcz merged commit 3da2639 into main Jun 15, 2024
@skrawcz skrawcz deleted the fix_950 branch June 15, 2024 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Value Error When Applying Multiple Data Validation Decorators to the Same Function

2 participants