From 6a9ef5dc6a310d96ba7aa6899896dfdf859875fa Mon Sep 17 00:00:00 2001 From: KoalaGeo Date: Mon, 24 Apr 2023 20:38:50 +0100 Subject: [PATCH] try insert metadata tags --- app/main.py | 57 +++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/app/main.py b/app/main.py index 7aa2fe1f..9f53550e 100644 --- a/app/main.py +++ b/app/main.py @@ -77,33 +77,6 @@ def setup_logging(logging_level=logging.INFO): async def landing_page(request: Request): return templates.TemplateResponse('landing_page.html', {'request': request}) -def custom_openapi(): - if app.openapi_schema: - return app.openapi_schema - openapi_schema = get_openapi( - title="pyagsapi - AGS File Utilities Tools and API", - version="4.5.0", - description=("The API performs schema validation, data validation and conversion of your AGS files. It also exports a graphical log from AGS data held by NGDC" - "Schema validation and conversion uses https://gitlab.com/ags-data-format-wg/ags-python-library"), - terms_of_service="https://www.bgs.ac.uk/legal-and-policy/terms-of-use/", - contact={ - "name": "BGS Enquiries", - "url": "https://www.bgs.ac.uk/about-bgs/contact-us/", - "email": "enquiries@bgs.ac.uk", - }, - license_info={ - "name": "Open Government Licence v3", - "url": "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", - }, - routes=app.routes, - ) - openapi_schema["info"]["x-logo"] = { - "url": ("https://raw.githubusercontent.com/BritishGeologicalSurvey/pyagsapi" - "/main/app/static/img/BGS-Logo-Pos-RGB-01.png") - } - app.openapi_schema = openapi_schema - return app.openapi_schema - tags_metadata = [ { "name": "validate", @@ -125,12 +98,40 @@ def custom_openapi(): "name": "ags_log", "description": "Generate a graphical log (.pdf) from AGS data held by the National Geoscience Data Centre.", "externalDocs": { - "description": "NGDC AGS Data", + "description": "NGDC AGS Borehole Index", "url": "https://ogcapi.bgs.ac.uk/collections/agsboreholeindex", }, }, ] +def custom_openapi(): + if app.openapi_schema: + return app.openapi_schema + openapi_schema = get_openapi( + title="pyagsapi - AGS File Utilities Tools and API", + version="4.5.0", + description=("The API performs schema validation, data validation and conversion of your AGS files. It also exports a graphical log from AGS data held by NGDC" + "Schema validation and conversion uses https://gitlab.com/ags-data-format-wg/ags-python-library"), + terms_of_service="https://www.bgs.ac.uk/legal-and-policy/terms-of-use/", + contact={ + "name": "BGS Enquiries", + "url": "https://www.bgs.ac.uk/about-bgs/contact-us/", + "email": "enquiries@bgs.ac.uk", + }, + license_info={ + "name": "Open Government Licence v3", + "url": "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", + }, + openapi_tags=tags_metadata, + routes=app.routes, + ) + openapi_schema["info"]["x-logo"] = { + "url": ("https://raw.githubusercontent.com/BritishGeologicalSurvey/pyagsapi" + "/main/app/static/img/BGS-Logo-Pos-RGB-01.png") + } + app.openapi_schema = openapi_schema + return app.openapi_schema + app.openapi = custom_openapi