Browse Source

add simple tags for endpoints in autogenerated doc

Guénaël Muller 6 years ago
parent
commit
421742049c

+ 5 - 3
tracim/views/core_api/session_controller.py View File

@@ -16,10 +16,12 @@ from tracim.views.core_api.schemas import BasicAuthSchema
16 16
 from tracim.exceptions import NotAuthenticated
17 17
 from tracim.exceptions import AuthenticationFailed
18 18
 
19
+SESSION_ENDPOINTS_TAG = 'Session'
20
+
19 21
 
20 22
 class SessionController(Controller):
21 23
 
22
-    @hapic.with_api_doc()
24
+    @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG])
23 25
     @hapic.input_headers(LoginOutputHeaders())
24 26
     @hapic.input_body(BasicAuthSchema())
25 27
     @hapic.handle_exception(AuthenticationFailed, HTTPStatus.BAD_REQUEST)
@@ -42,7 +44,7 @@ class SessionController(Controller):
42 44
         user = uapi.authenticate_user(login.email, login.password)
43 45
         return uapi.get_user_with_context(user)
44 46
 
45
-    @hapic.with_api_doc()
47
+    @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG])
46 48
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
47 49
     def logout(self, context, request: TracimRequest, hapic_data=None):
48 50
         """
@@ -51,7 +53,7 @@ class SessionController(Controller):
51 53
 
52 54
         return
53 55
 
54
-    @hapic.with_api_doc()
56
+    @hapic.with_api_doc(tags=[SESSION_ENDPOINTS_TAG])
55 57
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
56 58
     @hapic.output_body(UserSchema(),)
57 59
     def whoami(self, context, request: TracimRequest, hapic_data=None):

+ 3 - 2
tracim/views/core_api/system_controller.py View File

@@ -18,10 +18,11 @@ from tracim.views.controllers import Controller
18 18
 from tracim.views.core_api.schemas import ApplicationSchema
19 19
 from tracim.views.core_api.schemas import ContentTypeSchema
20 20
 
21
+SYSTEM_ENDPOINTS_TAG = 'System'
21 22
 
22 23
 class SystemController(Controller):
23 24
 
24
-    @hapic.with_api_doc()
25
+    @hapic.with_api_doc(tags=[SYSTEM_ENDPOINTS_TAG])
25 26
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
26 27
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
27 28
     @require_profile(Group.TIM_USER)
@@ -32,7 +33,7 @@ class SystemController(Controller):
32 33
         """
33 34
         return applications
34 35
 
35
-    @hapic.with_api_doc()
36
+    @hapic.with_api_doc(tags=[SYSTEM_ENDPOINTS_TAG])
36 37
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
37 38
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
38 39
     @require_profile(Group.TIM_USER)

+ 3 - 1
tracim/views/core_api/user_controller.py View File

@@ -20,10 +20,12 @@ from tracim.views.controllers import Controller
20 20
 from tracim.views.core_api.schemas import UserIdPathSchema
21 21
 from tracim.views.core_api.schemas import WorkspaceDigestSchema
22 22
 
23
+USERS_ENDPOINTS_TAG = 'Users'
24
+
23 25
 
24 26
 class UserController(Controller):
25 27
 
26
-    @hapic.with_api_doc()
28
+    @hapic.with_api_doc(tags=[USERS_ENDPOINTS_TAG])
27 29
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
28 30
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
29 31
     @hapic.handle_exception(UserDoesNotExist, HTTPStatus.NOT_FOUND)

+ 11 - 9
tracim/views/core_api/workspace_controller.py View File

@@ -35,10 +35,12 @@ from tracim.views.core_api.schemas import WorkspaceMemberSchema
35 35
 from tracim.models.contents import ContentTypeLegacy as ContentType
36 36
 from tracim.models.revision_protection import new_revision
37 37
 
38
+WORKSPACES_ENDPOINTS_TAG = 'Workspaces'
39
+
38 40
 
39 41
 class WorkspaceController(Controller):
40 42
 
41
-    @hapic.with_api_doc()
43
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
42 44
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
43 45
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
44 46
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
@@ -58,7 +60,7 @@ class WorkspaceController(Controller):
58 60
         )
59 61
         return wapi.get_workspace_with_context(request.current_workspace)
60 62
 
61
-    @hapic.with_api_doc()
63
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
62 64
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
63 65
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
64 66
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
@@ -87,7 +89,7 @@ class WorkspaceController(Controller):
87 89
             for user_role in roles
88 90
         ]
89 91
 
90
-    @hapic.with_api_doc()
92
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
91 93
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
92 94
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
93 95
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
@@ -123,7 +125,7 @@ class WorkspaceController(Controller):
123 125
         ]
124 126
         return contents
125 127
 
126
-    @hapic.with_api_doc()
128
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
127 129
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
128 130
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
129 131
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
@@ -156,7 +158,7 @@ class WorkspaceController(Controller):
156 158
         content = api.get_content_in_context(content)
157 159
         return content
158 160
 
159
-    @hapic.with_api_doc()
161
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
160 162
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
161 163
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
162 164
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
@@ -215,7 +217,7 @@ class WorkspaceController(Controller):
215 217
         )
216 218
         return api.get_content_in_context(updated_content)
217 219
 
218
-    @hapic.with_api_doc()
220
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
219 221
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
220 222
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
221 223
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
@@ -250,7 +252,7 @@ class WorkspaceController(Controller):
250 252
             api.delete(content)
251 253
         return
252 254
 
253
-    @hapic.with_api_doc()
255
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
254 256
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
255 257
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
256 258
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
@@ -286,7 +288,7 @@ class WorkspaceController(Controller):
286 288
             api.undelete(content)
287 289
         return
288 290
 
289
-    @hapic.with_api_doc()
291
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
290 292
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
291 293
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
292 294
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
@@ -318,7 +320,7 @@ class WorkspaceController(Controller):
318 320
             api.archive(content)
319 321
         return
320 322
 
321
-    @hapic.with_api_doc()
323
+    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
322 324
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
323 325
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
324 326
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)