Planning on submitting a PR to resolve this but I wanted to make this a possible function of the library:
GET /api/label/<string:label_name>
along with the ability to create relationships this way too to cut down on my frontend needing to make an extra get request to match up IDs to functions.
The issue comes in ResourceDetail's patch function:
https://github.com/TMiguelT/flapison/blob/master/flapison/resource.py#L327
The get function allows the kwargs to be modified in the before_get function but its broken in patch if you're trying to modify the kwargs in either before_patch or before_marshmallow due to this function (for some reason) relying solely on data from the request and now enabling it to be modified before doing queries on it.
https://github.com/TMiguelT/flapison/blob/master/flapison/resource.py#L353
Proposal:
Move before_patch to the top of the file as it should run before the patch function does.
Note:
This is the same issue for ResourceList's post function so I'll be submitting a fix for both
https://github.com/TMiguelT/flapison/blob/master/flapison/resource.py#L222
Planning on submitting a PR to resolve this but I wanted to make this a possible function of the library:
GET /api/label/<string:label_name>along with the ability to create relationships this way too to cut down on my frontend needing to make an extra get request to match up IDs to functions.
The issue comes in ResourceDetail's
patchfunction:https://github.com/TMiguelT/flapison/blob/master/flapison/resource.py#L327
The
getfunction allows the kwargs to be modified in thebefore_getfunction but its broken inpatchif you're trying to modify the kwargs in eitherbefore_patchorbefore_marshmallowdue to this function (for some reason) relying solely on data from the request and now enabling it to be modified before doing queries on it.https://github.com/TMiguelT/flapison/blob/master/flapison/resource.py#L353
Proposal:
Move
before_patchto the top of the file as it should run before the patch function does.Note:
This is the same issue for ResourceList's
postfunction so I'll be submitting a fix for bothhttps://github.com/TMiguelT/flapison/blob/master/flapison/resource.py#L222