Skip to content
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

Adds handling for query string schema #71

Merged
merged 1 commit into from
May 1, 2020
Merged

Adds handling for query string schema #71

merged 1 commit into from
May 1, 2020

Conversation

calvinwyoung
Copy link
Contributor

@calvinwyoung calvinwyoung commented Apr 16, 2020

@apryor6 This is a first draft at addressing issues #45 and #67. Per your instructions, I've added two new arguments, query_params_schema and headers_schema, which allow users to pass in marshmallow schemas for parsing query params and header values.

The current behavior is as follows:

  • Query params that get parsed and stored in request.parsed_query_params. Unknown values are excluded.
  • Headers get parsed and stored in request.parsed_headers. Unknown values are excluded.
  • All query param and header fields get added to the reqparse.RequestParser, which allows those fields to show up in the swagger docs. Unfortunately this also means that query param and header fields will show up in request.parsed_args, which could be confusing. If there's a better way to get the query params and headers to show up in the swagger docs, I'd be happy to update this.

Please treat this as as first pass as I'm not married to any of the implementation details — if there are better ways to implement any of this, then let me know. Once we're at a good place with the implementation, I can help update the documentation as well.

@codecov-io
Copy link

codecov-io commented Apr 16, 2020

Codecov Report

Merging #71 into master will increase coverage by 0.26%.
The diff coverage is 99.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #71      +/-   ##
==========================================
+ Coverage   97.82%   98.08%   +0.26%     
==========================================
  Files           6        6              
  Lines         781      994     +213     
==========================================
+ Hits          764      975     +211     
- Misses         17       19       +2     
Impacted Files Coverage Δ
flask_accepts/decorators/decorators.py 98.91% <97.91%> (-1.09%) ⬇️
flask_accepts/decorators/decorators_test.py 96.21% <100.00%> (+1.54%) ⬆️
flask_accepts/utils.py 100.00% <100.00%> (ø)
flask_accepts/utils_test.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update edce731...90e4603. Read the comment docs.

Adds support for headers schema

Adds more tests

Abstracts out is_list_field

Single quotes to double quotes

Fixes tests
@apryor6
Copy link
Owner

apryor6 commented May 1, 2020

So very sorry for the enormous delays on this. I’ve been slammed with work, but I promise to take a look over the weekend.

@apryor6
Copy link
Owner

apryor6 commented May 1, 2020

lgtm!

@apryor6 apryor6 merged commit 6b0b7f8 into apryor6:master May 1, 2020
@apryor6
Copy link
Owner

apryor6 commented May 1, 2020

Available on pypy in 0.17.0

@calvinwyoung calvinwyoung deleted the additional_request_schemas branch May 1, 2020 19:28
@calvinwyoung
Copy link
Contributor Author

Awesome, thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants