marshmallow-jsonapi icon indicating copy to clipboard operation
marshmallow-jsonapi copied to clipboard

Fix included_data and data["included"] type consistency.

Open AdrianVandierAst opened this issue 6 years ago • 1 comments

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.

AdrianVandierAst avatar Nov 07 '19 20:11 AdrianVandierAst

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.

AdrianVandierAst avatar Nov 08 '19 09:11 AdrianVandierAst