-
Notifications
You must be signed in to change notification settings - Fork 4
Allow post method validation endpoint #294
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
Conversation
|
Done in pair with @brunobord |
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.
Looks good, thank you, guys. I have a few little comments but they are not critical.
Also, you should squash your fixup commit (799536d).
docs/swagger/formidable.yml
Outdated
| /forms/{id}/validate/: | ||
| get: | ||
| summary: Validate a form | ||
| summary: Validate a form (GET method). GET and POST are equivalent. |
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.
Maybe add some comment that GET method will be removed soon?
Validate a form. GET and POST are equivalent, but GET is deprecated
| return self.form_invalid(form) | ||
|
|
||
| post = get | ||
|
|
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.
I would like to inverse the methods (as we will remove the GET method soon).
def post(self, request, **kwargs):
# all the code goes here
get = post
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.
Done, also added a deprecation warning as @brunobord suggested!
formidable/views.py
Outdated
| GET method is deprecated in favor of POST | ||
| """ | ||
| warnings.simplefilter('always', category=DeprecationWarning) |
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.
why adding a simple filter here? let the user's default, it should be fine.
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.
It was done this way on PeopleAsk, I removed it
brunobord
left a comment
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.
small change in the Changelog to be added.
CHANGELOG.rst
Outdated
| master (unreleased) | ||
| =================== | ||
|
|
||
| - Allow POST method for form validation endpoint. |
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.
FYI, there's a deprecations.rst document in the docs/ directory. I think we should do the following:
- Add a deprecation note here, in the Changelog, to inform the reader that this version (probably 1.3.0) will be the last to support the GET verb for the validation endpoint.
- When we'll do the release, we'll add this point to the
deprecations.rstdocument with the correct version number.
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.
The changelog has been updated :)
CHANGELOG.rst
Outdated
| =================== | ||
|
|
||
| - Allow POST method for form validation endpoint. | ||
| - Allow POST method for form validation endpoint. GET method is now deprecated, it's support will be dropped in the next version. |
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.
I prefer active voice:
Deprecation Warning: This version is the last to support the GET verb for the validation endpoint. We'll drop it in the next version.
|
don't forget to squash these! |
1c1f6b0 to
6da054b
Compare
6da054b to
42dc9dc
Compare
Review
formidable.ymlfile: runtox -e swagger-staticsto rebuild the swagger static files and commit the diff.CHANGELOG.rstUpdated