How to use the awokado.consts.BULK_UPDATE function in awokado

To help you get started, we’ve selected a few awokado examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 5783354 / awokado / awokado / documentation / generate.py View on Github external
def collect_path_info(self, r: Route):
        resource_ext = r.uri.split("/")[2]
        resource_name = resource_ext.replace("-", "_")
        route_method = r.method_name.lower()
        is_patch = route_method == "patch"
        is_post = route_method == "post"
        is_bulk = False
        route_w_id = "{resource_id}" in r.uri

        if is_patch:
            is_bulk = BULK_UPDATE in r.resource.Meta.methods and not route_w_id

        if not route_w_id and is_patch and not is_bulk:
            log.info(
                f"skip bulk patch with resource id "
                f"{r.uri}:{resource_name}:{route_method}"
            )
            return None, None

        if route_w_id and is_post:
            log.info(
                f"skip post with resource id "
                f"{r.uri}:{resource_name}:{route_method}"
            )
            return None, None

        path_info = self.get_common_info(r, resource_name)