From 0142e98dbab4db00adab45d589539c8459944940 Mon Sep 17 00:00:00 2001 From: vrde Date: Fri, 17 Aug 2018 14:08:49 +0200 Subject: [PATCH] Problem: Rapid JSON is outdated and slow (#2470) Solution: Use the last version of Rapid JSON. --- bigchaindb/common/schema/__init__.py | 5 ++--- setup.py | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bigchaindb/common/schema/__init__.py b/bigchaindb/common/schema/__init__.py index f29e9b44..914e5196 100644 --- a/bigchaindb/common/schema/__init__.py +++ b/bigchaindb/common/schema/__init__.py @@ -9,7 +9,6 @@ import logging import jsonschema import yaml import rapidjson -import rapidjson_schema from bigchaindb.common.exceptions import SchemaValidationError @@ -22,7 +21,7 @@ def _load_schema(name, path=__file__): path = os.path.join(os.path.dirname(path), name + '.yaml') with open(path) as handle: schema = yaml.safe_load(handle) - fast_schema = rapidjson_schema.loads(rapidjson.dumps(schema)) + fast_schema = rapidjson.Validator(rapidjson.dumps(schema)) return path, (schema, fast_schema) @@ -57,7 +56,7 @@ def _validate_schema(schema, body): # a helpful error message. try: - schema[1].validate(rapidjson.dumps(body)) + schema[1](rapidjson.dumps(body)) except ValueError as exc: try: jsonschema.validate(body, schema[0]) diff --git a/setup.py b/setup.py index eb781aee..dcecca51 100644 --- a/setup.py +++ b/setup.py @@ -80,7 +80,7 @@ install_requires = [ 'pymongo~=3.6', 'pysha3~=1.0.2', 'cryptoconditions~=0.6.0.dev', - 'python-rapidjson==0.0.11', + 'python-rapidjson~=0.6.0', 'logstats~=0.2.1', 'flask>=0.10.1', 'flask-cors~=3.0.0', @@ -90,7 +90,6 @@ install_requires = [ 'jsonschema~=2.5.1', 'pyyaml~=3.12', 'aiohttp~=3.0', - 'python-rapidjson-schema==0.1.1', 'bigchaindb-abci==0.5.1', 'setproctitle~=1.1.0', ]