diff --git a/README.md b/README.md index 99e3b35..c5bda52 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # postgres-json-schema +[![Build Status](https://travis-ci.org/gavinwahl/postgres-json-schema.svg?branch=master)](https://travis-ci.org/gavinwahl/postgres-json-schema) + postgres-json-schema allows validation of [JSON schemas](http://json-schema.org/) in PostgreSQL. It is implemented as a PL/pgSQL function and you can use it as a check constraint to validate the diff --git a/test.py b/test.py index 208713f..d464555 100644 --- a/test.py +++ b/test.py @@ -10,20 +10,30 @@ cur = conn.cursor() -EXCLUDE = {'optional', 'refRemote.json', 'definitions.json'} +EXCLUDE_FILES = {'optional', 'refRemote.json', 'definitions.json'} +EXCLUDE_TESTS = { + # json-schema-org/JSON-Schema-Test-Suite#130 + ('ref.json', 'escaped pointer ref', 'percent invalid'), + + # json-schema-org/JSON-Schema-Test-Suite#114 + ('ref.json', 'remote ref, containing refs itself', 'remote ref invalid'), +} os.chdir('JSON-Schema-Test-Suite/tests/draft4') failures = 0 test_files = sys.argv[1:] if not test_files: - test_files = [test_file for test_file in os.listdir('.') if test_file not in EXCLUDE] + test_files = [test_file for test_file in os.listdir('.') if test_file not in EXCLUDE_FILES] for test_file in test_files: with open(test_file) as f: suites = json.load(f) for suite in suites: for test in suite['tests']: + if (test_file, suite['description'], test['description']) in EXCLUDE_TESTS: + continue + def fail(e): print("%s: validate_json_schema('%s', '%s')" % (test_file, json.dumps(suite['schema']), json.dumps(test['data']))) print('Failed: %s: %s. %s' % (suite['description'], test['description'], e))