def _get_response_definition(self, schema):
     return {
         sw.description: get_response_description(schema),
         sw.content: {
             "application/json": {sw.schema: get_ref_schema(self._ref_base, schema)}
         },
     }
    def _get_paths(self, paths, default_headers_schema):
        path_definitions = {}

        for path, methods in paths.items():
            swagger_path, path_args = format_path_for_swagger(path)

            # Different Flask paths might correspond to the same Swagger path
            # because of Flask URL path converters. In this case, let's just
            # work off the same path definitions.
            if swagger_path in path_definitions:
                path_definition = path_definitions[swagger_path]
            else:
                path_definitions[swagger_path] = path_definition = {}

            if path_args:
                path_params = [
                    {
                        sw.name: path_arg.name,
                        sw.required: True,
                        sw.in_: sw.path,
                        sw.type_: self.flask_converters_to_swagger_types[path_arg.type],
                    }
                    for path_arg in path_args
                ]

                # We have to check for an ugly case here. If different Flask
                # paths that map to the same Swagger path use different URL
                # converters for the same parameter, we have a problem. Let's
                # just throw an error in this case.
                if sw.parameters in path_definition:
                    verify_parameters_are_the_same(
                        path_definition[sw.parameters], path_params
                    )

                path_definition[sw.parameters] = path_params

            for method, d in methods.items():
                responses_definition = {
                    sw.default: {
                        sw.description: get_response_description(
                            self.default_response_schema
                        ),
                        sw.schema: {
                            sw.ref: create_ref(
                                self._ref_base,
                                get_swagger_title(self.default_response_schema),
                            )
                        },
                    }
                }

                if d.response_body_schema:
                    for status_code, schema in d.response_body_schema.items():
                        if schema is not None:
                            response_definition = {
                                sw.description: get_response_description(schema),
                                sw.schema: get_ref_schema(self._ref_base, schema),
                            }

                            responses_definition[str(status_code)] = response_definition
                        else:
                            responses_definition[str(status_code)] = {
                                sw.description: "No response body."
                            }

                parameters_definition = []

                if d.query_string_schema:
                    parameters_definition.extend(
                        self._convert_jsonschema_to_list_of_parameters(
                            self._query_string_converter(d.query_string_schema),
                            in_=sw.query,
                        )
                    )

                if d.request_body_schema:
                    schema = d.request_body_schema

                    parameters_definition.append(
                        {
                            sw.name: schema.__class__.__name__,
                            sw.in_: sw.body,
                            sw.required: True,
                            sw.schema: get_ref_schema(self._ref_base, schema),
                        }
                    )

                if d.headers_schema is USE_DEFAULT and default_headers_schema:
                    parameters_definition.extend(
                        self._convert_jsonschema_to_list_of_parameters(
                            self._headers_converter(default_headers_schema),
                            in_=sw.header,
                        )
                    )
                elif (
                    d.headers_schema is not USE_DEFAULT and d.headers_schema is not None
                ):
                    parameters_definition.extend(
                        self._convert_jsonschema_to_list_of_parameters(
                            self._headers_converter(d.headers_schema), in_=sw.header
                        )
                    )

                method_lower = method.lower()
                path_definition[method_lower] = {
                    sw.operation_id: d.endpoint or get_swagger_title(d.func),
                    sw.responses: responses_definition,
                }

                if d.func.__doc__:
                    path_definition[method_lower][sw.description] = d.func.__doc__

                if parameters_definition:
                    path_definition[method_lower][sw.parameters] = parameters_definition

                if d.authenticator is None:
                    path_definition[method_lower][sw.security] = []
                elif d.authenticator is not USE_DEFAULT:
                    security = self.authenticator_converter.get_security_requirement(
                        d.authenticator
                    )
                    path_definition[method_lower][sw.security] = security

                if d.tags:
                    path_definition[method_lower][sw.tags] = d.tags

        return path_definitions