python-RequestParser is not returning error when different datatype is sent in request
<p>I have created Flask application in that i am using RequestParser to check datatype of input fields like below</p>

<pre><code>parser = reqparse.RequestParser()
parser.add_argument('article_id',type=str,required=True, help='SUP-REQ-ARTICLEID')
parser.add_argument('description',type=str,required=True, help='SUP-REQ-DESCRIPTION')
parser.add_argument('userid',type=str,required=True, help='SUP-REQ-USERID')
</code></pre>

<p>my json input from postman is like below </p>

<pre><code>{
    "article_id": 2,
    "description":"some description",
    "userid":1
}
</code></pre>

<p>so in json request first and third field is integer and in request parser the datatype i have mentioned as "str" </p>

<p>when i ran the application and send the request from postman -request is getting processed and not throwing any error in RequestParser validation </p>

<p>At first, Postman creates a regular HTTP post from your data. And HTTP posts looks like this:</p>

<pre class="lang-none prettyprint-override"><code>article_id=2&amp;description=some%20description&amp;userid=1
</code></pre>

<p>There is no type information, that's plain old URL encoding. <em>Everything</em> is a string in a URL, with <code>&amp;</code> and <code>=</code> as the separators.</p>

<p>All RequestParser can do is convert types for you, from string to something else. That's also why <code>type=str</code> is the default. The parser will simply give you strings for <code>article_id</code> and <code>userid</code> and that's it. </p>

<p>The errors occur when an argument <em>can't</em> be converted to the target type. Set <code>type=int</code> for <code>description</code> and it will give you an error.</p>

python json parsing flask-restful