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

ContraintStrategy in typescript declaration contains a validate function #323

Open
nickwinger opened this issue Apr 7, 2023 · 5 comments

Comments

@nickwinger
Copy link
Contributor

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.
@mcollina
Copy link
Collaborator

mcollina commented Apr 8, 2023

Thanks for reporting! Would you like to send a Pull Request to address this issue?

@nickwinger
Copy link
Contributor Author

Yes, sure. If it really is a relict like I’m thinking :)

@nickwinger
Copy link
Contributor Author

@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...

@ivan-tymoshenko
Copy link
Collaborator

@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.

@nickwinger
Copy link
Contributor Author

nickwinger commented Apr 8, 2023

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 :)

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

3 participants