Problem: Rapid JSON is outdated and slow (#2470)

Solution: Use the last version of Rapid JSON.
This commit is contained in:
vrde 2018-08-17 14:08:49 +02:00 committed by Vanshdeep Singh
parent abdd23f5a6
commit 0142e98dba
2 changed files with 3 additions and 5 deletions

View File

@ -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])

View File

@ -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',
]