-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Add a validator for documentation package names and base urls. #373
Conversation
Package names are used for stats in the bot and are restricted to the a-z_ char set, a validator is added to accommodate this restriction at the site admin side.
Thank you for contributing to Python Discord! Please check out the following documents:
|
Some packages can contain them and are good for stats.
The move prevents it going through the line limit and deeper nesting of parentheses from splitting up the string.
The validators kwarg expects an iterable of validators, while a validator directly was being supplied.
Thank you for contributing to Python Discord! Please check out the following documents:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should document in the viewset that a 400 will be returned by the POST due to the regex validator failing.
Isn't the current documentation pointing the user to see the response on 400s enough? site/pydis_site/apps/api/viewsets/bot/documentation_link.py Lines 48 to 60 in de7c6b3
|
URLs without a trailing slash won't get properly joined by the bot Adds compatibility with python-discord/bot@bc25bfd's changes The styling of how the regex decorator is constructed was changed to be consisted with the function validator
python-discord/bot#1014 will introduce a restriction on the package names to
a-z
,0-9
and_
because they will be used directly for stats and will enforce base urls to end with slashes. This PR implements the restrictions on the site side.