-
Notifications
You must be signed in to change notification settings - Fork 264
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
Feature request: URI Validation method that returns boolean #257
Comments
This is actually what the gem twingly-url is doing, see https://github.com/twingly/twingly-url#getting-started for some examples. It might be useful for you, or give you some inspiration on how to wrap addressable yourself. twingly-url is using addressable and public_suffix under the covers. (Full disclosure: I work for the company that made twingly-url) |
Nothing wrong with plugging your own gems ;) Thanks for the response, I'm not the owner of the code with the issue, I was enquiring as I liked the idea of a non aggressive validation method. |
Of course we can handle addressable's execption and wrap it internally in json-schema to get along. But as using exceptions for control flow is considered bad in general in programming (at least this is my perception), I thought it would be worth to raise this issue here at the root. And really no harm done if @sporkmonger looks at it and decides to leave things as they are. Its only about giving it a thought. |
As a matter of implementation, I agree that this should be a peer method to |
I'm going to close this one, and recommend use of https://github.com/twingly/twingly-url (or your own wrapper) if you want this. While it has a strange name (hehe) it does this and I think it does it well. I no longer work at Twingly but I still use it when I need to check if a URL is valid or not. |
Having come across an issue using ruby-json-schema, a discussion has been started here regarding parsing a URI using addressable, and managing failures and flow control with exceptions.
It was mentioned that having a method similar to
parse
that would validate a URI and return a boolean value if the URI was valid instead of raising an exception.tl;dr Can we have a URI validation method please that returns a boolean value.
The text was updated successfully, but these errors were encountered: