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

Add _validate_inputs class method to each constraint #878

Closed
amontanez24 opened this issue Jul 8, 2022 · 0 comments · Fixed by #914
Closed

Add _validate_inputs class method to each constraint #878

amontanez24 opened this issue Jul 8, 2022 · 0 comments · Fixed by #914
Assignees
Labels
feature request Request for a new feature
Milestone

Comments

@amontanez24
Copy link
Contributor

amontanez24 commented Jul 8, 2022

Problem Description

As a developer, it would be useful to check that the provided parameters for each constraint are valid since this is used when validating the metadata and also when creating a constraint.

Expected behavior

  • Add _validate_inputs class method to each constraint
  • The specific functionality differs for each constraint and is described below
  • Should catch and raise all errors together

Additional context

  • Constraint validation
    • Unique
      • "column_names" must be present
        Error: Missing required "column_names" in the Unique constraint
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a Unique constraint.
    • FixedCombinations
      • "column_names" must be present
        Error: Missing required values ("column_names") in a FixedCombinations constraint
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a FixedCombinations constraint.
    • Inequality
      • "high_column_name" and "low_column_name" must both be present
        Error: Missing required values ("high_column_name", "low_column_name") in an Inequality constraint
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a FixedCombinations constraint.
    • ScalarInequality
      • "relation", "column_name" and "value" must all be present
        Error: Missing required values ("relation", "column_name", "value") in a ScalarInequality constraint
      • "relation" must be one of ">", ">=", "<", "<="
        Error: Invalid relation value ("==") in a ScalarInequality constraint. The relation must be one of: ">", ">=", "<" or "<=".
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a ScalarInequality constraint.
    • Range
      • "high_column_name", "between_column_name" and "low_column_name" must both all present
        Error: Missing required values ("high_column_name", "between_column_name", "low_column_name") in a Range constraint.
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a Range constraint.
    • ScalarRange
      • Required params must be present
        Error: Missing required values ("column_name", "low_value", "high_value") in a ScalarRange constraint.
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a ScalarRange constraint.
    • Positive
      • Required params must be present
        Error: Missing required values ("column_name") in a Positive constraint.
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a Positive constraint.
    • Negative
      • Required params must be present
        Error: Missing required values ("column_name") in a Negative constraint.
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a Negative constraint.
    • FixedIncrements
      • All required values should be present
        Error: Missing required values ("column_name", "increment") in a FixedIncrements constraint
      • increment_value should be an integer >0
        Error: Invalid increment value (0.5) in a FixedIncrements constraint. Increments must be positive integers.
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a FixedIncrements constraint.
    • OneHotEncoding
      • "column_names" must be present
        Error: Missing required values ("column_names") in a OneHotEncoding constraint
      • No additional attributes should be present
        Error: Invalid values ("pii") are present in a OneHotEncoding constraint.
    • CustomConstraint
      • "column_names" must be present
        Error: Missing required values ("column_names") in a <name> constraint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants