Skip to content

Badly Architected Resource CRUD handlers makes it impossible to customize them #14

Description

@srhinos

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions