marshmallow-jsonapi
marshmallow-jsonapi copied to clipboard
Fix included_data and data["included"] type consistency.
The included resource objects in the json api are in a list but the schema implementation needs it to be a dict indexed by type and id. The new test checks that loading and then dumping with the same schema object on a dict with an included resource works. It is needed for Flask-rest-jsonapi that re-uses schema between load and dump.
I will response here to https://github.com/marshmallow-code/marshmallow-jsonapi/issues/133#issuecomment-551325190
Schema.included_data is consistently a dict for loading and dumping. And the "included" part of the json api object is consistently a list. And yes, the type inconsistency is an issue only if you reuse the schema.