From 05e0e8bdca3bab89cea15ea12db2d8e005317971 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 27 Dec 2020 12:48:13 +0200 Subject: [PATCH] openapi.json: Set the API version from config We don't need to hard code this in the JSON anymore since we are reading and modifying it now for the server config anyways. --- dspace_statistics_api/app.py | 3 +++ dspace_statistics_api/docs/openapi.json | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dspace_statistics_api/app.py b/dspace_statistics_api/app.py index 6bf0bfe..736eed1 100644 --- a/dspace_statistics_api/app.py +++ b/dspace_statistics_api/app.py @@ -58,6 +58,9 @@ class OpenAPIJSONResource: if DSPACE_STATISTICS_API_URL != "": data["servers"] = [{"url": DSPACE_STATISTICS_API_URL}] + # Set the version in the schema so Swagger UI can display it + data["info"]["version"] = VERSION + resp.body = json.dumps(data) diff --git a/dspace_statistics_api/docs/openapi.json b/dspace_statistics_api/docs/openapi.json index 45daedd..86eaa78 100644 --- a/dspace_statistics_api/docs/openapi.json +++ b/dspace_statistics_api/docs/openapi.json @@ -1,7 +1,6 @@ { "openapi": "3.0.3", "info": { - "version": "1.4.0-dev", "title": "DSpace Statistics API", "description": "A [Falcon-based](https://falcon.readthedocs.io/) web application to make DSpace's item, community, and collection statistics available via a simple REST API. This Swagger interface is powered by [falcon-swagger-ui](https://github.com/rdidyk/falcon-swagger-ui).", "license": {