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

Proper handling of empty attribute when minLength=1 #79

Open
donaldcampbelljr opened this issue Dec 23, 2024 · 1 comment
Open

Proper handling of empty attribute when minLength=1 #79

donaldcampbelljr opened this issue Dec 23, 2024 · 1 comment

Comments

@donaldcampbelljr
Copy link
Contributor

          Ok, for our desired use case, this causes eido validation to fail:
    _validate_sample_object(
  File "/home/drc/GITHUB/looper/master/looper/venv/lib/python3.10/site-packages/eido/validation.py", line 100, in _validate_sample_object
    _validate_object(sample.to_dict(), sample_schema_dict)
  File "/home/drc/GITHUB/looper/master/looper/venv/lib/python3.10/site-packages/eido/validation.py", line 47, in _validate_object
    instance_name = error.instance[sample_name_colname]
IndexError: string index out of range

This is because error.instance is empty and sample_name_colname=False

However, if you do have some value in the field such as 'h' but the minLength: 2, we see a better message:

Error: EidoValidationError (Validation failed): {"'h' is not valid under any of the given schemas": [{'type': "'h' is not valid under any of the given schemas", 'message': "'h' is not valid under any of the given schemas on instance h", 'sample_name': 'h'}]}
["'h' is not valid under any of the given schemas"]

Originally posted by @donaldcampbelljr in pepkit/looper#523 (comment)

@donaldcampbelljr
Copy link
Contributor Author

We should also probably have this functionality just work as intended where it expects a minLength if something is supplied in the required field. Right now, the user has to add the field under required AND add minLength to have this work as expected.

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

No branches or pull requests

1 participant