def _add_route_paths()

in chalice/deploy/swagger.py [0:0]


    def _add_route_paths(self, api, app):
        # type: (Dict[str, Any], Chalice) -> None
        for path, methods in app.routes.items():
            swagger_for_path = {}  # type: Dict[str, Any]
            api['paths'][path] = swagger_for_path

            cors_config = None
            methods_with_cors = []
            for http_method, view in methods.items():
                current = self._generate_route_method(view)
                if 'security' in current:
                    self._add_to_security_definition(
                        current['security'], api, view)
                swagger_for_path[http_method.lower()] = current
                if view.cors is not None:
                    cors_config = view.cors
                    methods_with_cors.append(http_method)

            # Chalice ensures that routes with multiple views have the same
            # CORS configuration. So if any entry has CORS enabled, use that
            # entry's CORS configuration for the preflight setup.
            if cors_config is not None:
                self._add_preflight_request(
                    cors_config, methods_with_cors, swagger_for_path)