twilio/flask-restful — pull request #312 by joshfriend (2014-10-13 02:09:33+00:00)
Title: Add store_missing option to Argument

Given the following `RequestParser`:
```python
parser = RequestParser()
parser.add_argument('name')
parser.add_argument('email')
```

And the following request:
```
PUT /users {"name": "foo"}
```

The current behavior of the parser will look like:
```python
args = parser.parse_args()
# args looks like: {u'name': u'foo', u'email': None}
```

The behavior I expected was:
```python
args = parser.parse_args()
# args looks like: {u'name': u'foo'}
```

To me this makes more sense because the request:
```
PUT /users {"name": "foo"}
```
will yield the same arguments as:
```
PUT /users {"name": "foo", "email": null}
```
There should be a difference between omitting the argument and explicitly setting it to `null` in the request. I'd like to propose adding a `store_missing` flag to the `Argument` class that tells the parser to store missing arguments in the restult set. The user can then check `'arg' in args` to see if the argument was actually provided by the request. Default values for missing arguments can still be handled easily with `args.get('arg', 'default')`.