Intercept and correct input type `bool` in reqparse dicts
See original GitHub issueSee this issue for a discussion around how RESTplus parses the string “false” as true with type=bool
.
We can fix this by intercepting the boolean parameter in the dicts that are being passed in @accepts
or @reponds
and casting them to flask_restplus.inputs.boolean
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
RequestParser doesn't handle booleans submitted as 'false ...
When the RequestParser is given an argument of type bool, it parses any value as ... Intercept and correct input type bool in...
Read more >flask restful: how to document response body with fields.Dict()?
In flask-restplus , I want to model the response body which has nested list strucure, so whenever make api call, response body will...
Read more >Python - Test Boolean Value of Dictionary - GeeksforGeeks
Method #1: Using loop This is brute force method to solve this problem. In this, we iterate for each key and tag it...
Read more >API — Flask Documentation (1.1.x)
In order to convert the return value to a proper response object, ... data – The request body, either as a string or...
Read more >Input Types - Strateos
Demonstrated below are the input types and parameters to construct the manifest. ... "required" field accepts a boolean value that indicates if this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
First install pytest (
pip install pytest
), and then runpytest
There’s a pytest.ini file at the root source directory that configures pytest for you
isinstance
should be preferred when checking the type of an object because it will also, in general, check subclasses of the type. In this specific case, it so happens thatbool
cannot be subclassed, but for consistency and readabilityisinstance
is still better.