From 364e827335a72a8649070de8a3be9b0fcf74b4f9 Mon Sep 17 00:00:00 2001 From: Thomas Pollet Date: Thu, 11 Jan 2024 08:09:06 +0100 Subject: [PATCH 1/2] disable swagger gen without blueprint --- safrs/safrs_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/safrs/safrs_api.py b/safrs/safrs_api.py index a910b96..174b8b2 100755 --- a/safrs/safrs_api.py +++ b/safrs/safrs_api.py @@ -67,6 +67,7 @@ def __init__( """ self._custom_swagger = kwargs.pop("custom_swagger", {}) + self.swaggerui_blueprint = swaggerui_blueprint kwargs["default_mediatype"] = "application/vnd.api+json" app_db = kwargs.pop("app_db", None) safrs.SAFRS(app, app_db=app_db, prefix=prefix, json_encoder=json_encoder, swaggerui_blueprint=swaggerui_blueprint, **kwargs) @@ -136,7 +137,7 @@ class Class_API(SAFRSRestAPI): api_class_name = f"{safrs_object._s_type}_API" # name for dynamically generated classes RESOURCE_URL_FMT = get_config("RESOURCE_URL_FMT") # configurable resource collection url formatter url = RESOURCE_URL_FMT.format(url_prefix, safrs_object._s_collection_name) - swagger_decorator = swagger_doc(safrs_object) + swagger_decorator = swagger_doc(safrs_object) if self.swaggerui_blueprint else lambda x : x api_class = api_decorator(type(api_class_name, (rest_api,), properties), swagger_decorator) safrs.log.info(f"Exposing {safrs_object._s_collection_name} on {url}, endpoint: {endpoint}") From e3c1b3e21b3eecd6611b8eaccf154c30c4323823 Mon Sep 17 00:00:00 2001 From: Thomas Pollet Date: Thu, 11 Jan 2024 08:09:56 +0100 Subject: [PATCH 2/2] set demo url --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 403bb61..7b833f7 100755 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ SAFRS exposes SQLAlchemy database models as a [JSON:API](https://jsonapi.org) we Documentation can be found in the [wiki](https://github.com/thomaxxl/safrs/wiki). -__A [LIVE DEMO](http://thomaxxl.pythonanywhere.com) is available__, where much of the basic functionality is implemented using a simple [example](examples/demo_pythonanywhere_com.py). +__A [LIVE DEMO](https://thomaxxl.pythonanywhere.com) is available__, where much of the basic functionality is implemented using a simple [example](examples/demo_pythonanywhere_com.py). ## Installation @@ -385,4 +385,4 @@ Feel free to open an issue or drop [me](mailto:thomas.pollet+no+spam+@gmail.com)
Thanks I developed this code when I worked at [Excellium Services](https://www.excellium-services.com/). They allowed me to open source it when I stopped working there. -
\ No newline at end of file +