Kaynağa Gözat

Add comments

Guénaël Muller 6 yıl önce
ebeveyn
işleme
1232e971c7
1 değiştirilmiş dosya ile 18 ekleme ve 2 silme
  1. 18 2
      hapic/hapic.py

+ 18 - 2
hapic/hapic.py Dosyayı Görüntüle

@@ -423,7 +423,15 @@ class Hapic(object):
423 423
             description=description,
424 424
         )
425 425
 
426
-        def spec_yaml_view( *args, **kwargs):
426
+        def spec_yaml_view(*args, **kwargs):
427
+            """
428
+            Method to return swagger generated yaml spec file.
429
+
430
+            This method will be call as a framework view, like those,
431
+            it need to handle the default arguments of a framework view.
432
+            As frameworks have different arguments patterns, we should
433
+            allow any arguments patterns (args, kwargs).
434
+            """
427 435
             return self.context.get_response(
428 436
                 doc_yaml,
429 437
                 mimetype='text/x-yaml',
@@ -441,13 +449,21 @@ class Hapic(object):
441 449
 
442 450
         # Declare the swaggerui view
443 451
         def api_doc_view(*args, **kwargs):
452
+            """
453
+            Method to return html index view of swagger ui.
454
+
455
+            This method will be call as a framework view, like those,
456
+            it need to handle the default arguments of a framework view.
457
+            As frameworks have different arguments patterns, we should
458
+            allow any arguments patterns (args, kwargs).
459
+            """
444 460
             return self.context.get_response(
445 461
                 doc_page_content,
446 462
                 http_code=HTTPStatus.OK,
447 463
                 mimetype='text/html',
448 464
             )
449 465
 
450
-        # Add a view to generate the html index page of swaggerui
466
+        # Add a view to generate the html index page of swagger-ui
451 467
         self.context.add_view(
452 468
             route=route,
453 469
             http_method='GET',