Closed quodt closed 13 years ago
just want to let you know I am looking at possible options, I think we can come up with a reasonable solution for this. had you put any thought into the proposed order?
at the very beginning i would check if optional
, then i would check the type
. after that i would validate things like minLength
, maximum
and things like that. finally i would check the format
.
Checks like blank
or pattern
make only sense after the check for 'type'.
The checks for title
and description
are not critical so it doesn't matter when to check.
For checks like dependencies
or additionalProperties
i do not really have an opinion.
i know the list is not complet but these are just some thoughts since i did not read each check in detail.
Sorry about the delay it has been a hectic month.. I've pushed an ordering branch, can you check if that meets your needs and if so I'll merge it into master
i'm afraid my shout was not justified. if a validator just returns if it does not get a value it has to validate we do not have a problem. i guess this issue can be classified as "human failure" and could get closed. sorry for the noise.
ah alright, no problem
I've problems while validating one field in my schema with a custom format validator.
hier ist a snippet of my schema containing the field i like to validate:
I've registered a custom formatter called 'sl:contract-periods' which does some checks with the contained items in the field. Since the method
__validate()
loops thru all schema properties to determine the required validators the validator calledvalidate_format
will get invoked earlier than the methodvalidate_minItems
,validate_optional
orvalidate_type_array
. So in my custom validator i have to check if the value is not None, a list-type and not empty which should get checked by the particular validators.One possible solution could be to hardcode a list of validators to force a sorting order and appending the not hardcoded validators to the list for the loop. But there may be nicer ways...