Skip to content

Commit f283aa8

Browse files
authored
Merge pull request #81 from Geode-solutions/fix/fast_json_schema
fix(fastjsonschema): replace jsonschema with fastjsonschema
2 parents bb26932 + 1a22cfc commit f283aa8

File tree

6 files changed

+10
-26
lines changed

6 files changed

+10
-26
lines changed

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
jsonschema
1+
fastjsonschema
22
wslink
33
websocket-client

requirements.txt

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.9
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# pip-compile requirements.in
@@ -8,37 +8,20 @@ aiohttp==3.9.3
88
# via wslink
99
aiosignal==1.3.1
1010
# via aiohttp
11-
async-timeout==4.0.3
12-
# via aiohttp
1311
attrs==23.2.0
14-
# via
15-
# aiohttp
16-
# jsonschema
17-
# referencing
12+
# via aiohttp
13+
fastjsonschema==2.21.1
14+
# via -r requirements.in
1815
frozenlist==1.4.1
1916
# via
2017
# aiohttp
2118
# aiosignal
2219
idna==3.6
2320
# via yarl
24-
jsonschema==4.21.1
25-
# via -r requirements.in
26-
jsonschema-specifications==2023.12.1
27-
# via jsonschema
2821
multidict==6.0.5
2922
# via
3023
# aiohttp
3124
# yarl
32-
python-dotenv==1.0.1
33-
# via -r requirements.in
34-
referencing==0.33.0
35-
# via
36-
# jsonschema
37-
# jsonschema-specifications
38-
rpds-py==0.18.0
39-
# via
40-
# jsonschema
41-
# referencing
4225
websocket-client==1.7.0
4326
# via -r requirements.in
4427
wslink==1.12.4

src/opengeodeweb_viewer/utils_functions.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import json
44

55
# Third party imports
6-
from jsonschema import validate
7-
from jsonschema.exceptions import ValidationError
6+
import fastjsonschema
7+
from fastjsonschema import JsonSchemaException
88

99
# Local application imports
1010

@@ -24,8 +24,9 @@ def get_schemas_dict(path):
2424
def validate_schema(params, schema, prefix=""):
2525
print(f"{prefix}{schema['rpc']}", f"{params=}", flush=True)
2626
try:
27-
validate(instance=params, schema=schema)
28-
except ValidationError as e:
27+
validate = fastjsonschema.compile(schema)
28+
validate(params)
29+
except fastjsonschema.JsonSchemaException as e:
2930
print(f"Validation error: {e.message}", flush=True)
3031
raise Exception(
3132
{
-197 Bytes
Loading
891 Bytes
Loading
1.12 KB
Loading

0 commit comments

Comments
 (0)