MCPcopy Index your code
hub / github.com/hugapi/hug / documentation

Method documentation

hug/interface.py:950–973  ·  view source on GitHub ↗

Returns the documentation specific to an HTTP interface

(self, add_to=None, version=None, prefix="", base_url="", url="")

Source from the content-addressed store, hash-verified

948 self.api.delete_context(context)
949
950 def documentation(self, add_to=None, version=None, prefix="", base_url="", url=""):
951 """Returns the documentation specific to an HTTP interface"""
952 doc = OrderedDict() if add_to is None else add_to
953
954 usage = self.interface.spec.__doc__
955 if usage:
956 doc["usage"] = usage
957
958 for example in self.examples:
959 example_text = "{0}{1}{2}{3}".format(
960 prefix, base_url, "/v{0}".format(version) if version else "", url
961 )
962 if isinstance(example, str):
963 example_text += "?{0}".format(example)
964 doc_examples = doc.setdefault("examples", [])
965 if not example_text in doc_examples:
966 doc_examples.append(example_text)
967
968 doc = super().documentation(doc)
969
970 if getattr(self, "output_doc", ""):
971 doc["outputs"]["type"] = self.output_doc
972
973 return doc
974
975 @lru_cache()
976 def urls(self, version=None):

Calls

no outgoing calls