You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to use marshmallow-jsonapi with webargs. Now one of the key features of the jsonapi schemas is the pre-load hook that unwraps the data from {data: {...}} into {...}. However, it seems that webargs never runs the pre-load hooks. For this reason, converting my code from:
defpost(self):
data=SomeJsonApiSchema().load(request.json)
# Use data somehow
to
@use_args(SomeJsonApiSchema(), locations=('json',))defpost(self):
# Use data somehow
does not work! It raises the error:
{'_schema': [{'detail': 'Object must include `data` key.', 'source': {'pointer': '/'}}]}
Now, it seems like we could easily run pre_dump hooks, if we loaded the entire input object in one go. However, we seem to re-parse the input data each time we need to parse a field, hence the need for the self._cache["json"] etc. Is there any reason for this? Why can't we get the entire input object as a dictionary, either from the query string, body, json etc?
The text was updated successfully, but these errors were encountered:
I'm attempting to use marshmallow-jsonapi with webargs. Now one of the key features of the jsonapi schemas is the pre-load hook that unwraps the data from
{data: {...}}
into{...}
. However, it seems that webargs never runs the pre-load hooks. For this reason, converting my code from:to
does not work! It raises the error:
Now, it seems like we could easily run pre_dump hooks, if we loaded the entire input object in one go. However, we seem to re-parse the input data each time we need to parse a field, hence the need for the
self._cache["json"]
etc. Is there any reason for this? Why can't we get the entire input object as a dictionary, either from the query string, body, json etc?The text was updated successfully, but these errors were encountered: