ContraintStrategy in typescript declaration contains a validate function
Opened this issue · 5 comments
Hello,
in the interface ConstraintStrategy in the typescript declaration there is a
```
validate(value: unknown): void
function that i cannot find in the source code or docs, so i guess it should be removed.
Thanks for reporting! Would you like to send a Pull Request to address this issue?
Yes, sure. If it really is a relict like I’m thinking :)
@mcollina Well i had a look at the source code and the validate function seems to be in use, although i cannot make you much sense, because it just asserts, without and try/catch handling and also it's nowhere found in the documentation... actually i think the function as it is now is also dangerous, because there is no way to gracefully do an error handling... if the validation is not successfull...
Also i can check the value of a ContraintStrategy elsewhere, so again i don't know what this function was for...
If i would remove it from the typings i should remove it from the js-source code, and that would be a breaking change... so...
@nickwinger Hi, I don't think we should remove this function. This function validates the constraint value you pass when you create a new route. If you want to add it to the doc, PR is always welcome.
Ah ok , i guess i understand now, it‘s not the runtime value, but at configuration time. But the typing then should contain ? as it is optional :)