-
Notifications
You must be signed in to change notification settings - Fork 809
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
feat: add isPort decorator #282
Conversation
@19majkel94 Care to check? :) |
@vlapo Before merging this PR I created another to DefinitelyTyped DefinitelyTyped/DefinitelyTyped#36978 because we are using their function which is not typed yet :P |
@vlapo Great! When you are going to make new release to npm? |
Do not have access to npm yet and I want to resolve one big issue before release (tree shaking, packaging and package size). So I do not have an ETA. I hope !maybe! end of month. :) |
Hmm okay. But wouldn't it make sense to do small releases as possible? Because if something breaks it easier to see what caused it :) VS if you released bunch of new fixes and features at the same time :P |
Sure lets do this in small steps. https://www.npmjs.com/package/class-validator/v/0.10.0-rc.1 happy testing :) We jump from [email protected] to 3.5.3. So we have to test this version on project with typescript < 3.0. I think there are some breaking changes with typings generated by typescript@3. |
Excellent! |
At least looks like |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Background
I have many validation classes where I want to validate ports and ended up doing this many times
But as you notice it will get very repetitive when I have to do this validation many for many properties.
Then I noticed validator.js already has validator for this: https://github.com/chriso/validator.js/#validators (search for isPort). So I ended up adding
IsPort
decorator.Result
Now I can just validate port like this
Also when I imported validator js correctly the code can use it types correctly. There were two mismatches with the types so I fixed them too. If you for example think that types in
isISBN
are wrong they should be fixed in validatorjs types repo :)Tell me what do you guys think <3