summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-06-21 10:32:48 -0400
committerJulian Berman <Julian@GrayVines.com>2022-06-21 10:32:48 -0400
commit2f3a79c61176f60c9244d07fa8afb728218270ff (patch)
tree7ddebc46110655a0f074873da796661494fa8844 /json
parentfdb18ea7546168e755e546b4d204058d58ff2e23 (diff)
parentaeecae37b17b430c328d3c3e15bec90d30c8848b (diff)
downloadjsonschema-2f3a79c61176f60c9244d07fa8afb728218270ff.tar.gz
Merge commit 'aeecae37b17b430c328d3c3e15bec90d30c8848b'
* commit 'aeecae37b17b430c328d3c3e15bec90d30c8848b': Squashed 'json/' changes from d40b3e62f..cf78d97d0
Diffstat (limited to 'json')
-rw-r--r--json/.gitignore161
-rw-r--r--json/index.js46
-rw-r--r--json/package.json28
-rw-r--r--json/remotes/locationIndependentIdentifier.json11
-rw-r--r--json/remotes/locationIndependentIdentifierDraft4.json11
-rw-r--r--json/remotes/locationIndependentIdentifierPre2019.json11
-rw-r--r--json/tests/draft-next/refRemote.json18
-rw-r--r--json/tests/draft2019-09/refRemote.json18
-rw-r--r--json/tests/draft2020-12/refRemote.json18
-rw-r--r--json/tests/draft4/refRemote.json18
-rw-r--r--json/tests/draft6/refRemote.json18
-rw-r--r--json/tests/draft7/refRemote.json18
12 files changed, 301 insertions, 75 deletions
diff --git a/json/.gitignore b/json/.gitignore
index 1333ed7..68bc17f 100644
--- a/json/.gitignore
+++ b/json/.gitignore
@@ -1 +1,160 @@
-TODO
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+*.py,cover
+.hypothesis/
+.pytest_cache/
+cover/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+.pybuilder/
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+# For a library or package, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# .python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# poetry
+# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
+# This is especially recommended for binary packages to ensure reproducibility, and is more
+# commonly ignored for libraries.
+# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
+#poetry.lock
+
+# pdm
+# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
+#pdm.lock
+# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
+# in version control.
+# https://pdm.fming.dev/#use-with-ide
+.pdm.toml
+
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
+__pypackages__/
+
+# Celery stuff
+celerybeat-schedule
+celerybeat.pid
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# pytype static type analyzer
+.pytype/
+
+# Cython debug symbols
+cython_debug/
+
+# PyCharm
+# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
+# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
+# and can be added to the global gitignore or merged into this file. For a more nuclear
+# option (not recommended) you can uncomment the following to ignore the entire idea folder.
+#.idea/
diff --git a/json/index.js b/json/index.js
deleted file mode 100644
index 7d01093..0000000
--- a/json/index.js
+++ /dev/null
@@ -1,46 +0,0 @@
-'use strict';
-
-const Ajv = require('ajv');
-const jsonSchemaTest = require('json-schema-test');
-
-const refs = {
- 'http://localhost:1234/integer.json': require('./remotes/integer.json'),
- 'http://localhost:1234/subSchemas.json': require('./remotes/subSchemas.json'),
- 'http://localhost:1234/baseUriChange/folderInteger.json': require('./remotes/baseUriChange/folderInteger.json'),
- 'http://localhost:1234/baseUriChangeFolder/folderInteger.json': require('./remotes/baseUriChange/folderInteger.json'),
- 'http://localhost:1234/baseUriChangeFolderInSubschema/folderInteger.json': require('./remotes/baseUriChange/folderInteger.json'),
- 'http://localhost:1234/name.json': require('./remotes/name.json'),
- 'http://localhost:1234/name-defs.json': require('./remotes/name-defs.json')
-};
-
-const SKIP = {
- 4: ['optional/zeroTerminatedFloats'],
- 7: [
- 'format/idn-email',
- 'format/idn-hostname',
- 'format/iri',
- 'format/iri-reference',
- 'optional/content'
- ]
-};
-
-[4, 6, 7].forEach((draft) => {
- let ajv;
- if (draft == 7) {
- ajv = new Ajv({format: 'full'});
- } else {
- const schemaId = draft == 4 ? 'id' : '$id';
- ajv = new Ajv({format: 'full', meta: false, schemaId});
- ajv.addMetaSchema(require(`ajv/lib/refs/json-schema-draft-0${draft}.json`));
- ajv._opts.defaultMeta = `http://json-schema.org/draft-0${draft}/schema#`;
- }
- for (const uri in refs) ajv.addSchema(refs[uri], uri);
-
- jsonSchemaTest(ajv, {
- description: `Test suite draft-0${draft}`,
- suites: {tests: `./tests/draft${draft}/{**/,}*.json`},
- skip: SKIP[draft],
- cwd: __dirname,
- hideFolder: 'tests/'
- });
-});
diff --git a/json/package.json b/json/package.json
deleted file mode 100644
index 3980136..0000000
--- a/json/package.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "name": "json-schema-test-suite",
- "version": "0.1.0",
- "description": "A language agnostic test suite for the JSON Schema specifications",
- "main": "index.js",
- "scripts": {
- "test": "mocha index.js -R spec"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/json-schema-org/JSON-Schema-Test-Suite.git"
- },
- "keywords": [
- "json-schema",
- "tests"
- ],
- "author": "http://json-schema.org",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/json-schema-org/JSON-Schema-Test-Suite/issues"
- },
- "homepage": "https://github.com/json-schema-org/JSON-Schema-Test-Suite#readme",
- "devDependencies": {
- "ajv": "^6.0.0-rc.1",
- "json-schema-test": "^2.0.0",
- "mocha": "^3.2.0"
- }
-}
diff --git a/json/remotes/locationIndependentIdentifier.json b/json/remotes/locationIndependentIdentifier.json
new file mode 100644
index 0000000..8795c01
--- /dev/null
+++ b/json/remotes/locationIndependentIdentifier.json
@@ -0,0 +1,11 @@
+{
+ "definitions": {
+ "refToInteger": {
+ "$ref": "#foo"
+ },
+ "A": {
+ "$anchor": "foo",
+ "type": "integer"
+ }
+ }
+}
diff --git a/json/remotes/locationIndependentIdentifierDraft4.json b/json/remotes/locationIndependentIdentifierDraft4.json
new file mode 100644
index 0000000..eeff1eb
--- /dev/null
+++ b/json/remotes/locationIndependentIdentifierDraft4.json
@@ -0,0 +1,11 @@
+{
+ "definitions": {
+ "refToInteger": {
+ "$ref": "#foo"
+ },
+ "A": {
+ "id": "#foo",
+ "type": "integer"
+ }
+ }
+}
diff --git a/json/remotes/locationIndependentIdentifierPre2019.json b/json/remotes/locationIndependentIdentifierPre2019.json
new file mode 100644
index 0000000..e72815c
--- /dev/null
+++ b/json/remotes/locationIndependentIdentifierPre2019.json
@@ -0,0 +1,11 @@
+{
+ "definitions": {
+ "refToInteger": {
+ "$ref": "#foo"
+ },
+ "A": {
+ "$id": "#foo",
+ "type": "integer"
+ }
+ }
+}
diff --git a/json/tests/draft-next/refRemote.json b/json/tests/draft-next/refRemote.json
index b607432..f122864 100644
--- a/json/tests/draft-next/refRemote.json
+++ b/json/tests/draft-next/refRemote.json
@@ -186,5 +186,23 @@
"valid": true
}
]
+ },
+ {
+ "description": "Location-independent identifier in remote ref",
+ "schema": {
+ "$ref": "http://localhost:1234/locationIndependentIdentifier.json#/definitions/refToInteger"
+ },
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": "foo",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2019-09/refRemote.json b/json/tests/draft2019-09/refRemote.json
index b607432..f122864 100644
--- a/json/tests/draft2019-09/refRemote.json
+++ b/json/tests/draft2019-09/refRemote.json
@@ -186,5 +186,23 @@
"valid": true
}
]
+ },
+ {
+ "description": "Location-independent identifier in remote ref",
+ "schema": {
+ "$ref": "http://localhost:1234/locationIndependentIdentifier.json#/definitions/refToInteger"
+ },
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": "foo",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft2020-12/refRemote.json b/json/tests/draft2020-12/refRemote.json
index b607432..f122864 100644
--- a/json/tests/draft2020-12/refRemote.json
+++ b/json/tests/draft2020-12/refRemote.json
@@ -186,5 +186,23 @@
"valid": true
}
]
+ },
+ {
+ "description": "Location-independent identifier in remote ref",
+ "schema": {
+ "$ref": "http://localhost:1234/locationIndependentIdentifier.json#/definitions/refToInteger"
+ },
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": "foo",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft4/refRemote.json b/json/tests/draft4/refRemote.json
index ce5e99a..412c9ff 100644
--- a/json/tests/draft4/refRemote.json
+++ b/json/tests/draft4/refRemote.json
@@ -167,5 +167,23 @@
"valid": false
}
]
+ },
+ {
+ "description": "Location-independent identifier in remote ref",
+ "schema": {
+ "$ref": "http://localhost:1234/locationIndependentIdentifierDraft4.json#/definitions/refToInteger"
+ },
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": "foo",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft6/refRemote.json b/json/tests/draft6/refRemote.json
index a2221b2..3b5a7fb 100644
--- a/json/tests/draft6/refRemote.json
+++ b/json/tests/draft6/refRemote.json
@@ -192,5 +192,23 @@
"valid": true
}
]
+ },
+ {
+ "description": "Location-independent identifier in remote ref",
+ "schema": {
+ "$ref": "http://localhost:1234/locationIndependentIdentifierPre2019.json#/definitions/refToInteger"
+ },
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": "foo",
+ "valid": false
+ }
+ ]
}
]
diff --git a/json/tests/draft7/refRemote.json b/json/tests/draft7/refRemote.json
index a2221b2..3b5a7fb 100644
--- a/json/tests/draft7/refRemote.json
+++ b/json/tests/draft7/refRemote.json
@@ -192,5 +192,23 @@
"valid": true
}
]
+ },
+ {
+ "description": "Location-independent identifier in remote ref",
+ "schema": {
+ "$ref": "http://localhost:1234/locationIndependentIdentifierPre2019.json#/definitions/refToInteger"
+ },
+ "tests": [
+ {
+ "description": "integer is valid",
+ "data": 1,
+ "valid": true
+ },
+ {
+ "description": "string is invalid",
+ "data": "foo",
+ "valid": false
+ }
+ ]
}
]