Skip to content

Commit

Permalink
Squashed 'JSON-Schema-Test-Suite/' changes from 0f888a8..689d2f2
Browse files Browse the repository at this point in the history
689d2f2 Add a 'latest' symlink.
e26d9bc Move the anchor-related tests to an anchor file.
19e7dfe Change location-independent IDs to use $anchor.
4e6c78b Make the draft3 ECMA regex tests consistently named.
433ab2f Merge pull request #286 from Zac-HD/not-patterns
dbaa3aa Fix data - escape unicode, not regex pattern
2d55450 Merge pull request #284 from Zac-HD/newlines
c8f8789 Add trailine-newline tests for $ pattern
586515e Bump up the length of acceptable descriptions.
0518c65 Merge remote-tracking branch 'Zac-HD/ecma-regex'
c0b2431 Tests for ECMA 262 regex dialect
b6f79ee Merge pull request #281 from Zac-HD/unique-array-of-items
7c20615 Check uniqueItems with array items
2ebedeb Regenerate the remotes [just for trailing newlines essentially.]
98bb02a Output the trailing newline.
3f44bc7 Uh, this actually should be a native string.
f7cc4cb Sanity check on a non-dying Python.
2903943 Merge pull request #277 from json-schema-org/non-string-formats
95425df Move tests for builtin formats ignoring non-strings upstream.
aa71850 Merge pull request #278 from gregsdennis/master
4b63803 updated 2019-09 references to correct schema uri
8656a71 moved 2019-08 tests to 2019-09; fixed a few 2019-06 $refs

git-subtree-dir: JSON-Schema-Test-Suite
git-subtree-split: 689d2f28182720d3778ca91c149f725a6ce73f71
  • Loading branch information
David Harsha committed Oct 20, 2019
1 parent cc74ff6 commit 5519c42
Show file tree
Hide file tree
Showing 79 changed files with 3,485 additions and 115 deletions.
13 changes: 8 additions & 5 deletions bin/jsonschema_suite
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ class SanityTests(unittest.TestCase):

def test_all_descriptions_have_reasonable_length(self):
for case in cases(self.test_files):
descript = case["description"]
description = case["description"]
self.assertLess(
len(descript),
60,
"%r is too long! (keep it to less than 60 chars)" % (descript,)
len(description),
70,
"%r is too long! (keep it to less than 70 chars)" % (
description,
),
)

def test_all_descriptions_are_unique(self):
Expand Down Expand Up @@ -217,8 +219,9 @@ def main(arguments):
if e.errno != errno.EEXIST:
raise

with open(filepath, "wb") as out_file:
with open(filepath, "w") as out_file:
json.dump(schema, out_file, indent=4, sort_keys=True)
out_file.write("\n")
elif arguments.command == "serve":
try:
from flask import Flask, jsonify
Expand Down
2 changes: 1 addition & 1 deletion remotes/folder/folderInteger.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"type": "integer"
}
}
2 changes: 1 addition & 1 deletion remotes/integer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"type": "integer"
}
}
8 changes: 6 additions & 2 deletions remotes/name-defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
"$defs": {
"orNull": {
"anyOf": [
{"type": "null"},
{"$ref": "#"}
{
"type": "null"
},
{
"$ref": "#"
}
]
}
},
Expand Down
8 changes: 6 additions & 2 deletions remotes/name.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
"definitions": {
"orNull": {
"anyOf": [
{"type": "null"},
{"$ref": "#"}
{
"type": "null"
},
{
"$ref": "#"
}
]
}
},
Expand Down
4 changes: 2 additions & 2 deletions remotes/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"integer": {
"type": "integer"
},
},
"refToInteger": {
"$ref": "#/integer"
}
}
}
13 changes: 0 additions & 13 deletions tests/draft2019-08/optional/ecmascript-regex.json

This file was deleted.

File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions tests/draft2019-09/anchor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[
{
"description": "Location-independent identifier",
"schema": {
"allOf": [{
"$ref": "#foo"
}],
"$defs": {
"A": {
"$anchor": "foo",
"type": "integer"
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": true
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
},
{
"description": "Location-independent identifier with absolute URI",
"schema": {
"allOf": [{
"$ref": "http://localhost:1234/bar#foo"
}],
"$defs": {
"A": {
"$id": "http://localhost:1234/bar",
"$anchor": "foo",
"type": "integer"
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": true
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
},
{
"description": "Location-independent identifier with base URI change in subschema",
"schema": {
"$id": "http://localhost:1234/root",
"allOf": [{
"$ref": "http://localhost:1234/nested.json#foo"
}],
"$defs": {
"A": {
"$id": "nested.json",
"$defs": {
"B": {
"$anchor": "foo",
"type": "integer"
}
}
}
}
},
"tests": [
{
"data": 1,
"description": "match",
"valid": true
},
{
"data": "a",
"description": "mismatch",
"valid": false
}
]
}
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/draft2019-08/defs.json → tests/draft2019-09/defs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"description": "valid definition",
"schema": {"$ref": "http://json-schema.org/draft/2019-06/schema#"},
"schema": {"$ref": "https://json-schema.org/draft/2019-09/schema"},
"tests": [
{
"description": "valid definition schema",
Expand All @@ -12,7 +12,7 @@
},
{
"description": "invalid definition",
"schema": {"$ref": "http://json-schema.org/draft/2019-06/schema#"},
"schema": {"$ref": "https://json-schema.org/draft/2019-09/schema"},
"tests": [
{
"description": "invalid definition schema",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5519c42

Please sign in to comment.