Пример #1
0
    def load(self, path):
        rpc_methods = []
        methods_dir = os.path.join(self.api_dir, path)

        if not os.path.exists(methods_dir):
            return rpc_methods

        for method in os.listdir(methods_dir):

            if method.startswith(".") or method.endswith("_doc.md"):
                continue

            # load data
            data = read_file(os.path.join(methods_dir, method))
            responses = self._load_responses(method, data)

            # load description
            description_path = os.path.join(methods_dir, "%s_doc.md" % method)
            description = read_file(description_path)
            if description:
                description = markdown(description,
                                       protocol="rpc",
                                       ref_id=method)

            # upstream server
            upstream_server = self.application_data.get_rpc_upstream_server(
                method)

            rpc_methods.append({
                "name": method,
                "id": method.replace(".", ""),
                "responses": responses,
                "description": description,
                "upstream_server": upstream_server
            })

        return rpc_methods
Пример #2
0
    def load(self, path):
        rpc_methods = []
        methods_dir = os.path.join(self.api_dir, path)

        if not os.path.exists(methods_dir):
            return rpc_methods

        for method in os.listdir(methods_dir):

            if method.startswith(".") or method.endswith("_doc.md"):
                continue

            # load data
            data = read_file(os.path.join(methods_dir, method))
            responses = self._load_responses(method, data)

            # load description
            description_path = os.path.join(
                methods_dir, "%s_doc.md" % method)
            description = read_file(description_path)
            if description:
                description = markdown(
                    description, protocol="rpc", ref_id=method)

            # upstream server
            upstream_server = self.application_data.get_rpc_upstream_server(
                method)

            rpc_methods.append({
                "name": method,
                "id": method.replace(".", ""),
                "responses": responses,
                "description": description,
                "upstream_server": upstream_server
            })

        return rpc_methods
Пример #3
0
 def description(self, value):
     self.plain_description = value
     self._description = markdown(value, protocol="rest", ref_id=self.id)
Пример #4
0
 def description(self, value):
     self.plain_description = value
     self._description = markdown(value, protocol="rest", ref_id=self.id)