-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
fields.URL validation error should specify "not a valid FQDN" if trying to pass hostname without domain #2243
Comments
I have no objection to this. PR welcome. |
Relates to marshmallow-code#2243 Signed-off-by: ff137 <[email protected]>
Hi @lafrech The main thing is just to improve "Not a valid URL" being a confusing message when inputting something that looks like a valid URL ... If TLD is required, and "http://test-url" is passed, I set the error message to be: "URL must include a top-level domain (e.g., '.com', '.org')." I wanted to include a note that it's because of the So, it's just my initial attempt, and feedback is welcome! |
Resolves marshmallow-code#2243 Signed-off-by: ff137 <[email protected]>
The current validation error message:
'Not a valid URL.'
is not descriptive enough to help the user, especially when they are passing a value that would appear to be a valid URL to most people, such as a docker hostname:http://test-url:8001
Sample code:
This is because fields.URL has a default:
require_tld=True
, forrequire_tld: Whether to reject non-FQDN hostnames.
FQDN = fully-qualified domain name. i.e.
http://server1.example.com
is a FQDN,http://server1
is not.Suggestion: error message should be more descriptive when require_tld is True, and validation fails FQDN requirement.
The text was updated successfully, but these errors were encountered: