|
@@ -75,6 +75,13 @@ class Hapic(object):
|
75
|
75
|
def context(self) -> ContextInterface:
|
76
|
76
|
return self._context
|
77
|
77
|
|
|
78
|
+ def set_context(self, context: ContextInterface) -> None:
|
|
79
|
+ assert not self._context
|
|
80
|
+ self._context = context
|
|
81
|
+
|
|
82
|
+ def reset_context(self) -> None:
|
|
83
|
+ self._context = None
|
|
84
|
+
|
78
|
85
|
def with_api_doc(self):
|
79
|
86
|
def decorator(func):
|
80
|
87
|
@functools.wraps(func)
|
|
@@ -103,10 +110,6 @@ class Hapic(object):
|
103
|
110
|
|
104
|
111
|
return decorator
|
105
|
112
|
|
106
|
|
- def set_context(self, context: ContextInterface) -> None:
|
107
|
|
- assert not self._context
|
108
|
|
- self._context = context
|
109
|
|
-
|
110
|
113
|
def output_body(
|
111
|
114
|
self,
|
112
|
115
|
schema: typing.Any,
|
|
@@ -338,5 +341,9 @@ class Hapic(object):
|
338
|
341
|
return decoration.get_wrapper(func)
|
339
|
342
|
return decorator
|
340
|
343
|
|
341
|
|
- def generate_doc(self):
|
342
|
|
- return self.doc_generator.get_doc(self._controllers, self.context)
|
|
344
|
+ def generate_doc(self, title: str='', description: str=''):
|
|
345
|
+ return self.doc_generator.get_doc(
|
|
346
|
+ self._controllers,
|
|
347
|
+ self.context,
|
|
348
|
+ title=title,
|
|
349
|
+ description=description)
|