Closed TiborVoelcker closed 2 years ago
Thanks, this is indeed something I was aware of (and support adding) -- though the way I'd want to do so would be more similar to how TYPE_CHECKER is an attribute on validators.
So, in your example, you'd use:
Validator = validator_for(schema)
Validator(schema, format_checker=Validator.FORMAT_CHECKER).validate(instance)
with the addition of the FORMAT_CHECKER
attribute.
Certainly willing to see a PR adding it!
Alright, I will see what I can do. I am very busy at the moment tho, so I will try to look into it when I have the time. Great package BTW!
Thanks, sounds great, and appreciated!
Hi! Sorry for lettings this sit for such a long time. I found some time a while ago, but was completely lost when looking through the code. Now I found time again, and was determined to succeed. I tried to get an overview, but I am still a bit overwhelmed. But if I assessed it correctly, the change needed for this is very minor. So I did make a PR #905.
BTW: I could not figure out how to assign you to the PR, or link this issue with the PR.
Closed in #905.
(Not sure if this is already a feature, and I just could not get it to work.)
I want my validator automatically detected using the "$schema" keyword, to leave it customizable. But I would also need the formats to be validated. I know I could use
validate(instance, schema, format_checker=draft202012_format_checker)
. But I would like to just use the corresponding format_checker. Meaning, if my "$schema" keyword leads to using theDraft202012Validator
, I would want to automatically use thedraft202012_format_checker
. If I useDraft7Validator
, use thedraft7_format_checker
, etc.My proposal would be to accept
format_checker=True
, to then use the corresponding Format Validator.