jspg progress

This commit is contained in:
2026-02-17 17:41:54 -05:00
parent 6e06b6fdc2
commit 32ed463df8
188 changed files with 36654 additions and 15058 deletions

143
tests/fixtures/optional/contentSchema.json vendored Executable file
View File

@ -0,0 +1,143 @@
[
{
"description": "validation of binary-encoded media type documents with schema",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contentMediaType": "application/json",
"contentEncoding": "base64",
"contentSchema": { "required": ["foo"], "properties": { "foo": { "type": "string" } } }
},
"tests": [
{
"description": "a valid base64-encoded JSON document",
"data": "eyJmb28iOiAiYmFyIn0K",
"valid": true
},
{
"description": "another valid base64-encoded JSON document",
"data": "eyJib28iOiAyMCwgImZvbyI6ICJiYXoifQ==",
"valid": true
},
{
"description": "an invalid base64-encoded JSON document; validates false",
"data": "eyJib28iOiAyMH0=",
"valid": false
},
{
"description": "an empty object as a base64-encoded JSON document; validates false",
"data": "e30=",
"valid": false
},
{
"description": "an empty array as a base64-encoded JSON document",
"data": "W10=",
"valid": true
},
{
"description": "a validly-encoded invalid JSON document; validates false",
"data": "ezp9Cg==",
"valid": false
},
{
"description": "an invalid base64 string that is valid JSON; validates false",
"data": "{}",
"valid": false
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
}
]
},
{
"description": "contentSchema without contentMediaType",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contentEncoding": "base64",
"contentSchema": { "required": ["foo"], "properties": { "foo": { "type": "string" } } }
},
"tests": [
{
"description": "a valid base64-encoded JSON document",
"data": "eyJmb28iOiAiYmFyIn0K",
"valid": true
},
{
"description": "another valid base64-encoded JSON document",
"data": "eyJib28iOiAyMCwgImZvbyI6ICJiYXoifQ==",
"valid": true
},
{
"description": "an invalid base64-encoded JSON document; validates true",
"data": "eyJib28iOiAyMH0=",
"valid": true
},
{
"description": "an empty object as a base64-encoded JSON document; validates true",
"data": "e30=",
"valid": true
},
{
"description": "an empty array as a base64-encoded JSON document",
"data": "W10=",
"valid": true
},
{
"description": "a validly-encoded invalid JSON document; validates true",
"data": "ezp9Cg==",
"valid": true
},
{
"description": "an invalid base64 string that is valid JSON; validates false",
"data": "{}",
"valid": false
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
}
]
},
{
"description": "contentSchema without contentEncoding",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contentMediaType": "application/json",
"contentSchema": { "required": ["foo"], "properties": { "foo": { "type": "string" } } }
},
"tests": [
{
"description": "a valid JSON document",
"data": "{\"foo\": \"bar\"}",
"valid": true
},
{
"description": "another valid base64-encoded JSON document",
"data": "{\"boo\": 20, \"foo\": \"baz\"}",
"valid": true
},
{
"description": "an empty object; validates false",
"data": "{}",
"valid": false
},
{
"description": "an empty array; validates false",
"data": "[]",
"valid": true
},
{
"description": "invalid JSON document; validates false",
"data": "[}",
"valid": false
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
}
]
}
]

16
tests/fixtures/optional/format/date.json vendored Executable file
View File

@ -0,0 +1,16 @@
[
{
"description": "validation of date strings",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"format": "date"
},
"tests": [
{
"description": "contains alphabets",
"data": "yyyy-mm-dd",
"valid": false
}
]
}
]

16
tests/fixtures/optional/format/duration.json vendored Executable file
View File

@ -0,0 +1,16 @@
[
{
"description": "validation of duration strings",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"format": "duration"
},
"tests": [
{
"description": "more than one T",
"data": "PT1MT1S",
"valid": false
}
]
}
]

31
tests/fixtures/optional/format/email.json vendored Executable file
View File

@ -0,0 +1,31 @@
[
{
"description": "validation of duration strings",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"format": "email"
},
"tests": [
{
"description": "non printable character",
"data": "a\tb@gmail.com",
"valid": false
},
{
"description": "tab ok if quoted",
"data": "\"a\tb\"@gmail.com",
"valid": true
},
{
"description": "quote inside quoted",
"data": "\"a\"b\"@gmail.com",
"valid": false
},
{
"description": "backslash inside quoted",
"data": "\"a\\b\"@gmail.com",
"valid": false
}
]
}
]

23
tests/fixtures/optional/format/time.json vendored Executable file
View File

@ -0,0 +1,23 @@
[
{
"description": "validation of time strings",
"schema": { "format": "time" },
"tests": [
{
"description": "contains alphabets",
"data": "ab:cd:efZ",
"valid": false
},
{
"description": "no digit in second fraction",
"data": "23:20:50.Z",
"valid": false
},
{
"description": "alphabets in offset",
"data": "08:30:06+ab:cd",
"valid": false
}
]
}
]