Browse Source

better doc for schema

Guénaël Muller 6 years ago
parent
commit
01ed587cfa

+ 1 - 1
tracim/views/contents_api/html_document_controller.py View File

@@ -70,7 +70,7 @@ class HTMLDocumentController(Controller):
70 70
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
71 71
     @hapic.input_body(HtmlDocumentModifySchema())
72 72
     @hapic.output_body(HtmlDocumentContentSchema())
73
-    def update_html_document(self, context, request: TracimRequest, hapic_data=None):
73
+    def update_html_document(self, context, request: TracimRequest, hapic_data=None):  # nopep8
74 74
         """
75 75
         update_html_document
76 76
         """

+ 17 - 1
tracim/views/core_api/schemas.py View File

@@ -358,7 +358,7 @@ class ContentDigestSchema(marshmallow.Schema):
358 358
     )
359 359
     label = marshmallow.fields.Str(example='Intervention Report 12')
360 360
     content_type = marshmallow.fields.Str(
361
-        example='htmlpage',
361
+        example='html-content',
362 362
         validate=OneOf([content.slug for content in CONTENT_DEFAULT_TYPE]),
363 363
     )
364 364
     sub_content_types = marshmallow.fields.List(
@@ -403,10 +403,18 @@ class ContentSchema(ContentDigestSchema):
403 403
 
404 404
 
405 405
 class ThreadContentSchema(ContentSchema):
406
+    content_type = marshmallow.fields.Str(
407
+        example='thread',
408
+        validate=OneOf([content.slug for content in CONTENT_DEFAULT_TYPE]),
409
+    )
406 410
     raw_content = marshmallow.fields.String('Description of Thread')
407 411
 
408 412
 
409 413
 class HtmlDocumentContentSchema(ContentSchema):
414
+    content_type = marshmallow.fields.Str(
415
+        example='html-content',
416
+        validate=OneOf([content.slug for content in CONTENT_DEFAULT_TYPE]),
417
+    )
410 418
     raw_content = marshmallow.fields.String('<p>Html page Content !</p>')
411 419
 
412 420
 #####
@@ -425,10 +433,18 @@ class RevisionSchema(ContentDigestSchema):
425 433
 
426 434
 
427 435
 class ThreadRevisionSchema(RevisionSchema):
436
+    content_type = marshmallow.fields.Str(
437
+        example='thread',
438
+        validate=OneOf([content.slug for content in CONTENT_DEFAULT_TYPE]),
439
+    )
428 440
     raw_content = marshmallow.fields.String('Description of Thread')
429 441
 
430 442
 
431 443
 class HtmlDocumentRevisionSchema(RevisionSchema):
444
+    content_type = marshmallow.fields.Str(
445
+        example='html-content',
446
+        validate=OneOf([content.slug for content in CONTENT_DEFAULT_TYPE]),
447
+    )
432 448
     raw_content = marshmallow.fields.String('<p>Html page Content !</p>')
433 449
 
434 450