-
-
Notifications
You must be signed in to change notification settings - Fork 979
Open
Labels
enhancementgood first issueComment on this issue if you'd like to volunteer to work on this. Thanks!Comment on this issue if you'd like to volunteer to work on this. Thanks!
Milestone
Description
As we are planning to add OpenAPI spec affordances down the 4.x road, we'll need to make adjustments to our request utility methods.
We should add a helper for getting a param as OAS "object", the suggested method name is req.get_param_as_dict():
- required – Set to True to raise
HTTPBadRequestinstead of returning None when the parameter is not found (default False). - deep_object – Set to True to use the
deepObject(as in OAS) format. Note that this would deviate from other param methods as it would aggregate the return value from multiple parameters following the deep object name pattern. - delimiter – TBD (?) When not using deep_object, to get elements from delimited list items, depends on Add delimiter support to
req.get_param_as_list()#2538. - store – A dict-like object in which to place the value of the param, but only if the param is found (default None).
- default – If the param is not found returns the given value instead of None.
When not using deep_object, we would basically assert that the number of items from get_param_as_list() is even, and zip it pairwise to return a dict.
We could also name the method req.get_param_as_object(), but since other get_param_as_* methods follow the Python types, req.get_param_as_dict() probably sounds more fitting?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementgood first issueComment on this issue if you'd like to volunteer to work on this. Thanks!Comment on this issue if you'd like to volunteer to work on this. Thanks!