diff --git a/requirements.in b/requirements.in index 7520d92..c7dfbb5 100644 --- a/requirements.in +++ b/requirements.in @@ -1,3 +1,3 @@ -jsonschema +fastjsonschema wslink websocket-client \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2983880..07fda19 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.9 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile requirements.in @@ -8,37 +8,20 @@ aiohttp==3.9.3 # via wslink aiosignal==1.3.1 # via aiohttp -async-timeout==4.0.3 - # via aiohttp attrs==23.2.0 - # via - # aiohttp - # jsonschema - # referencing + # via aiohttp +fastjsonschema==2.21.1 + # via -r requirements.in frozenlist==1.4.1 # via # aiohttp # aiosignal idna==3.6 # via yarl -jsonschema==4.21.1 - # via -r requirements.in -jsonschema-specifications==2023.12.1 - # via jsonschema multidict==6.0.5 # via # aiohttp # yarl -python-dotenv==1.0.1 - # via -r requirements.in -referencing==0.33.0 - # via - # jsonschema - # jsonschema-specifications -rpds-py==0.18.0 - # via - # jsonschema - # referencing websocket-client==1.7.0 # via -r requirements.in wslink==1.12.4 diff --git a/src/opengeodeweb_viewer/utils_functions.py b/src/opengeodeweb_viewer/utils_functions.py index 635b3c9..edf3163 100644 --- a/src/opengeodeweb_viewer/utils_functions.py +++ b/src/opengeodeweb_viewer/utils_functions.py @@ -3,8 +3,8 @@ import json # Third party imports -from jsonschema import validate -from jsonschema.exceptions import ValidationError +import fastjsonschema +from fastjsonschema import JsonSchemaException # Local application imports @@ -24,8 +24,9 @@ def get_schemas_dict(path): def validate_schema(params, schema, prefix=""): print(f"{prefix}{schema['rpc']}", f"{params=}", flush=True) try: - validate(instance=params, schema=schema) - except ValidationError as e: + validate = fastjsonschema.compile(schema) + validate(params) + except fastjsonschema.JsonSchemaException as e: print(f"Validation error: {e.message}", flush=True) raise Exception( { diff --git a/src/tests/data/take_screenshot_with_background.jpg b/src/tests/data/take_screenshot_with_background.jpg index 7edd297..b490cfc 100644 Binary files a/src/tests/data/take_screenshot_with_background.jpg and b/src/tests/data/take_screenshot_with_background.jpg differ diff --git a/src/tests/data/take_screenshot_with_background.png b/src/tests/data/take_screenshot_with_background.png index ef275f9..6dcfc0b 100644 Binary files a/src/tests/data/take_screenshot_with_background.png and b/src/tests/data/take_screenshot_with_background.png differ diff --git a/src/tests/data/take_screenshot_without_background.png b/src/tests/data/take_screenshot_without_background.png index 6dda998..d67f309 100644 Binary files a/src/tests/data/take_screenshot_without_background.png and b/src/tests/data/take_screenshot_without_background.png differ