3
3
import json
4
4
import gzip
5
5
import logging
6
+ from turtle import title
6
7
7
8
from apispec import APISpec
8
9
from apispec .ext .marshmallow import MarshmallowPlugin
@@ -652,8 +653,12 @@ def associated_string_genes(gene_symbol: str, min_combined_score: int = 400) ->
652
653
spec = APISpec (
653
654
title = "BioAPI" ,
654
655
version = VERSION ,
655
- openapi_version = "2.0.1" ,
656
- info = dict (description = "A powerful abstraction of genomics databases." ),
656
+ openapi_version = "2.0.0" ,
657
+ info = dict (
658
+ description = """
659
+ ## A powerful abstraction of genomics databases.
660
+ BioAPI is part of the Multiomix project. For more information, visit our [website](https://omicsdatascience.org/).
661
+ To contribute: [OmicsDatascience](https://github.com/omics-datascience/BioAPI)""" ),
657
662
plugins = [FlaskPlugin (), MarshmallowPlugin ()]
658
663
)
659
664
@@ -667,13 +672,17 @@ def create_app():
667
672
# Spec API url or path
668
673
API_URL = '/static/apispec.json'
669
674
670
- # Call factory function to create our blueprint
671
- swaggerui_blueprint = get_swaggerui_blueprint (SWAGGER_URL , API_URL , config = {
672
- 'operationsSorter' : 'alpha' ,
673
- 'tagsSorter' : 'alpha' ,
674
- "defaultModelsExpandDepth" : - 1 , # Oculta la sección "Models"
675
- 'filter' : True # Permite usar un campo de búsqueda para filtrar métodos en Swagger UI
676
- })
675
+ # Config and Call factory function to create our blueprint
676
+ swagger_ui_config = {
677
+ 'docExpansion' : False , # Avoid extended tags
678
+ 'displayRequestDuration' : False , # Hide the duration of the request
679
+ 'tryItOutEnabled' : False , # Enables testing functions without clicking "Try it out"
680
+ 'supportedSubmitMethods' : ['get' , 'post' ], # Allows testing only GET and POST methods
681
+ 'validatorUrl' : False , # Avoid online validation of documentation
682
+ "defaultModelsExpandDepth" : - 1 , # Hide the Models section
683
+ 'filter' : False , # Hide the method filter field
684
+ }
685
+ swaggerui_blueprint = get_swaggerui_blueprint (SWAGGER_URL , API_URL , config = swagger_ui_config )
677
686
flask_app .register_blueprint (swaggerui_blueprint )
678
687
679
688
flask_app .config .update ({'APISPEC_SPEC' : spec , 'APISPEC_SWAGGER_UI_URL' : SWAGGER_URL })
@@ -684,8 +693,7 @@ def create_app():
684
693
@flask_app .route (API_URL )
685
694
def swagger_json ():
686
695
""" Path to get OpenAPI Spec in ${API_URL}"""
687
- schema = app .config ['APISPEC_SPEC' ].to_dict ()
688
-
696
+ schema = app .config ['APISPEC_SPEC' ].to_dict ()
689
697
for path , methods in schema .get ("paths" , {}).items ():
690
698
methods .pop ("options" , None )
691
699
0 commit comments