├── .github └── workflows │ ├── build.yml │ └── deploy.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── pom.xml └── src ├── main └── kotlin │ └── net │ └── pwall │ └── json │ └── schema │ ├── JSONSchema.kt │ ├── JSONSchemaException.kt │ ├── output │ ├── BasicErrorEntry.kt │ ├── BasicOutput.kt │ ├── DetailedOutput.kt │ └── Output.kt │ ├── parser │ ├── InputDetails.kt │ ├── JSONReader.kt │ └── Parser.kt │ ├── subschema │ ├── AdditionalItemsSchema.kt │ ├── AdditionalPropertiesSchema.kt │ ├── AllOfSchema.kt │ ├── AnyOfSchema.kt │ ├── CombinationSchema.kt │ ├── ExtensionSchema.kt │ ├── IfThenElseSchema.kt │ ├── ItemsArraySchema.kt │ ├── ItemsSchema.kt │ ├── OneOfSchema.kt │ ├── PatternPropertiesSchema.kt │ ├── PropertiesSchema.kt │ ├── PropertyNamesSchema.kt │ ├── RefSchema.kt │ └── RequiredSchema.kt │ └── validation │ ├── ArrayValidator.kt │ ├── ConstValidator.kt │ ├── ContainsValidator.kt │ ├── DefaultValidator.kt │ ├── DelegatingValidator.kt │ ├── EnumValidator.kt │ ├── FormatValidator.kt │ ├── NumberValidator.kt │ ├── PatternValidator.kt │ ├── PropertiesValidator.kt │ ├── StringValidator.kt │ ├── TypeValidator.kt │ └── UniqueItemsValidator.kt └── test ├── kotlin └── net │ └── pwall │ └── json │ └── schema │ ├── JSONSchemaCustomValidatorTest.kt │ ├── JSONSchemaExamplesTest.kt │ ├── JSONSchemaItemsTest.kt │ ├── JSONSchemaNonstandardFormatTest.kt │ ├── JSONSchemaOneOfTest.kt │ ├── JSONSchemaPropertiesTest.kt │ ├── JSONSchemaTest.kt │ ├── MetaSchemaTest.kt │ ├── parser │ ├── JSONReaderTest.kt │ └── ParserTest.kt │ ├── testsuite │ ├── TestGroup.kt │ ├── TestItem.kt │ └── TestSuiteTests.kt │ ├── util.kt │ └── validation │ └── FormatValidatorTest.kt └── resources ├── empty.schema.json ├── example-error1.json ├── example-error2.json ├── example-error3.json ├── example-error4.json ├── example.json ├── example.schema.json ├── example.schema.yaml ├── false.schema.json ├── http ├── testhttp1.json └── testhttp2.json ├── invalid-1.schema.json ├── jar └── example.jar ├── metaschema ├── meta │ ├── applicator.schema.json │ ├── content.schema.json │ ├── core.schema.json │ ├── format.schema.json │ ├── meta-data.schema.json │ └── validation.schema.json ├── output │ └── schema.schema.json └── schema.schema.json ├── person-invalid-uuid.json ├── person.json ├── test-additional-false.schema.json ├── test-additional.schema.json ├── test-anyof.schema.json ├── test-const.schema.json ├── test-contains-minmax.schema.json ├── test-contains.schema.json ├── test-custom-validator.schema.json ├── test-default-invalid.schema.json ├── test-default-valid.schema.json ├── test-description-ref.schema.yaml ├── test-description-text.txt ├── test-domestic-address.schema.json ├── test-enum.schema.json ├── test-example-invalid-2.schema.json ├── test-example-invalid.schema.json ├── test-example-valid.schema.json ├── test-examples-invalid.schema.json ├── test-examples-valid.schema.json ├── test-if-then-else.schema.json ├── test-international-address.schema.json ├── test-item-array.schema.json ├── test-item.schema.json ├── test-nonstandard-format.schema.json ├── test-not.schema.json ├── test-oneof.schema.json ├── test-pattern-properties.schema.json ├── test-property-names.schema.json ├── test-ref.json ├── test-ref.schema.json ├── test-string-format.schema.json ├── test-string-length.schema.json ├── test-string-pattern.schema.json ├── test-suite ├── LICENSE ├── remotes │ ├── baseUriChange │ │ └── folderInteger.json │ ├── baseUriChangeFolder │ │ └── folderInteger.json │ ├── baseUriChangeFolderInSubschema │ │ └── folderInteger.json │ ├── integer.json │ ├── name-defs.json │ ├── name.json │ ├── subSchemas-defs.json │ └── subSchemas.json └── tests │ ├── draft2019-09 │ ├── additionalItems.json │ ├── additionalProperties.json │ ├── allOf.json │ ├── anchor.json │ ├── anyOf.json │ ├── boolean_schema.json │ ├── const.json │ ├── contains.json │ ├── content.json │ ├── default.json │ ├── defs.json │ ├── dependentRequired.json │ ├── dependentSchemas.json │ ├── enum.json │ ├── exclusiveMaximum.json │ ├── exclusiveMinimum.json │ ├── format.json │ ├── id.json │ ├── if-then-else.json │ ├── infinite-loop-detection.json │ ├── items.json │ ├── maxContains.json │ ├── maxItems.json │ ├── maxLength.json │ ├── maxProperties.json │ ├── maximum.json │ ├── minContains.json │ ├── minItems.json │ ├── minLength.json │ ├── minProperties.json │ ├── minimum.json │ ├── multipleOf.json │ ├── not.json │ ├── oneOf.json │ ├── optional │ │ ├── bignum.json │ │ ├── ecmascript-regex.json │ │ ├── float-overflow.json │ │ ├── format │ │ │ ├── date-time.json │ │ │ ├── date.json │ │ │ ├── duration.json │ │ │ ├── email.json │ │ │ ├── hostname.json │ │ │ ├── idn-email.json │ │ │ ├── idn-hostname.json │ │ │ ├── ipv4.json │ │ │ ├── ipv6.json │ │ │ ├── iri-reference.json │ │ │ ├── iri.json │ │ │ ├── json-pointer.json │ │ │ ├── regex.json │ │ │ ├── relative-json-pointer.json │ │ │ ├── time.json │ │ │ ├── uri-reference.json │ │ │ ├── uri-template.json │ │ │ ├── uri.json │ │ │ └── uuid.json │ │ ├── non-bmp-regex.json │ │ └── refOfUnknownKeyword.json │ ├── pattern.json │ ├── patternProperties.json │ ├── properties.json │ ├── propertyNames.json │ ├── recursiveRef.json │ ├── ref.json │ ├── refRemote.json │ ├── required.json │ ├── type.json │ ├── unevaluatedItems.json │ ├── unevaluatedProperties.json │ └── uniqueItems.json │ ├── draft2020-12 │ ├── additionalProperties.json │ ├── allOf.json │ ├── anchor.json │ ├── anyOf.json │ ├── boolean_schema.json │ ├── const.json │ ├── contains.json │ ├── content.json │ ├── default.json │ ├── defs.json │ ├── dependentRequired.json │ ├── dependentSchemas.json │ ├── dynamicRef.json │ ├── enum.json │ ├── exclusiveMaximum.json │ ├── exclusiveMinimum.json │ ├── format.json │ ├── id.json │ ├── if-then-else.json │ ├── infinite-loop-detection.json │ ├── items.json │ ├── maxContains.json │ ├── maxItems.json │ ├── maxLength.json │ ├── maxProperties.json │ ├── maximum.json │ ├── minContains.json │ ├── minItems.json │ ├── minLength.json │ ├── minProperties.json │ ├── minimum.json │ ├── multipleOf.json │ ├── not.json │ ├── oneOf.json │ ├── optional │ │ ├── bignum.json │ │ ├── ecmascript-regex.json │ │ ├── float-overflow.json │ │ ├── format │ │ │ ├── date-time.json │ │ │ ├── date.json │ │ │ ├── duration.json │ │ │ ├── email.json │ │ │ ├── hostname.json │ │ │ ├── idn-email.json │ │ │ ├── idn-hostname.json │ │ │ ├── ipv4.json │ │ │ ├── ipv6.json │ │ │ ├── iri-reference.json │ │ │ ├── iri.json │ │ │ ├── json-pointer.json │ │ │ ├── regex.json │ │ │ ├── relative-json-pointer.json │ │ │ ├── time.json │ │ │ ├── uri-reference.json │ │ │ ├── uri-template.json │ │ │ ├── uri.json │ │ │ └── uuid.json │ │ ├── non-bmp-regex.json │ │ └── refOfUnknownKeyword.json │ ├── pattern.json │ ├── patternProperties.json │ ├── prefixItems.json │ ├── properties.json │ ├── propertyNames.json │ ├── ref.json │ ├── refRemote.json │ ├── required.json │ ├── type.json │ ├── unevaluatedItems.json │ ├── unevaluatedProperties.json │ └── uniqueItems.json │ ├── draft3 │ ├── additionalItems.json │ ├── additionalProperties.json │ ├── default.json │ ├── dependencies.json │ ├── disallow.json │ ├── divisibleBy.json │ ├── enum.json │ ├── extends.json │ ├── format.json │ ├── infinite-loop-detection.json │ ├── items.json │ ├── maxItems.json │ ├── maxLength.json │ ├── maximum.json │ ├── minItems.json │ ├── minLength.json │ ├── minimum.json │ ├── optional │ │ ├── bignum.json │ │ ├── ecmascript-regex.json │ │ ├── format │ │ │ ├── color.json │ │ │ ├── date-time.json │ │ │ ├── date.json │ │ │ ├── email.json │ │ │ ├── host-name.json │ │ │ ├── ip-address.json │ │ │ ├── ipv6.json │ │ │ ├── regex.json │ │ │ ├── time.json │ │ │ └── uri.json │ │ ├── non-bmp-regex.json │ │ └── zeroTerminatedFloats.json │ ├── pattern.json │ ├── patternProperties.json │ ├── properties.json │ ├── ref.json │ ├── refRemote.json │ ├── required.json │ ├── type.json │ └── uniqueItems.json │ ├── draft4 │ ├── additionalItems.json │ ├── additionalProperties.json │ ├── allOf.json │ ├── anyOf.json │ ├── default.json │ ├── definitions.json │ ├── dependencies.json │ ├── enum.json │ ├── format.json │ ├── id.json │ ├── infinite-loop-detection.json │ ├── items.json │ ├── maxItems.json │ ├── maxLength.json │ ├── maxProperties.json │ ├── maximum.json │ ├── minItems.json │ ├── minLength.json │ ├── minProperties.json │ ├── minimum.json │ ├── multipleOf.json │ ├── not.json │ ├── oneOf.json │ ├── optional │ │ ├── bignum.json │ │ ├── ecmascript-regex.json │ │ ├── float-overflow.json │ │ ├── format │ │ │ ├── date-time.json │ │ │ ├── email.json │ │ │ ├── hostname.json │ │ │ ├── ipv4.json │ │ │ ├── ipv6.json │ │ │ └── uri.json │ │ ├── non-bmp-regex.json │ │ └── zeroTerminatedFloats.json │ ├── pattern.json │ ├── patternProperties.json │ ├── properties.json │ ├── ref.json │ ├── refRemote.json │ ├── required.json │ ├── type.json │ └── uniqueItems.json │ ├── draft6 │ ├── additionalItems.json │ ├── additionalProperties.json │ ├── allOf.json │ ├── anyOf.json │ ├── boolean_schema.json │ ├── const.json │ ├── contains.json │ ├── default.json │ ├── definitions.json │ ├── dependencies.json │ ├── enum.json │ ├── exclusiveMaximum.json │ ├── exclusiveMinimum.json │ ├── format.json │ ├── id.json │ ├── infinite-loop-detection.json │ ├── items.json │ ├── maxItems.json │ ├── maxLength.json │ ├── maxProperties.json │ ├── maximum.json │ ├── minItems.json │ ├── minLength.json │ ├── minProperties.json │ ├── minimum.json │ ├── multipleOf.json │ ├── not.json │ ├── oneOf.json │ ├── optional │ │ ├── bignum.json │ │ ├── ecmascript-regex.json │ │ ├── float-overflow.json │ │ ├── format │ │ │ ├── date-time.json │ │ │ ├── email.json │ │ │ ├── hostname.json │ │ │ ├── ipv4.json │ │ │ ├── ipv6.json │ │ │ ├── json-pointer.json │ │ │ ├── uri-reference.json │ │ │ ├── uri-template.json │ │ │ └── uri.json │ │ └── non-bmp-regex.json │ ├── pattern.json │ ├── patternProperties.json │ ├── properties.json │ ├── propertyNames.json │ ├── ref.json │ ├── refRemote.json │ ├── required.json │ ├── type.json │ └── uniqueItems.json │ ├── draft7 │ ├── additionalItems.json │ ├── additionalProperties.json │ ├── allOf.json │ ├── anyOf.json │ ├── boolean_schema.json │ ├── const.json │ ├── contains.json │ ├── default.json │ ├── definitions.json │ ├── dependencies.json │ ├── enum.json │ ├── exclusiveMaximum.json │ ├── exclusiveMinimum.json │ ├── format.json │ ├── id.json │ ├── if-then-else.json │ ├── infinite-loop-detection.json │ ├── items.json │ ├── maxItems.json │ ├── maxLength.json │ ├── maxProperties.json │ ├── maximum.json │ ├── minItems.json │ ├── minLength.json │ ├── minProperties.json │ ├── minimum.json │ ├── multipleOf.json │ ├── not.json │ ├── oneOf.json │ ├── optional │ │ ├── bignum.json │ │ ├── content.json │ │ ├── ecmascript-regex.json │ │ ├── float-overflow.json │ │ ├── format │ │ │ ├── date-time.json │ │ │ ├── date.json │ │ │ ├── email.json │ │ │ ├── hostname.json │ │ │ ├── idn-email.json │ │ │ ├── idn-hostname.json │ │ │ ├── ipv4.json │ │ │ ├── ipv6.json │ │ │ ├── iri-reference.json │ │ │ ├── iri.json │ │ │ ├── json-pointer.json │ │ │ ├── regex.json │ │ │ ├── relative-json-pointer.json │ │ │ ├── time.json │ │ │ ├── uri-reference.json │ │ │ ├── uri-template.json │ │ │ └── uri.json │ │ └── non-bmp-regex.json │ ├── pattern.json │ ├── patternProperties.json │ ├── properties.json │ ├── propertyNames.json │ ├── ref.json │ ├── refRemote.json │ ├── required.json │ ├── type.json │ └── uniqueItems.json │ └── latest │ ├── additionalProperties.json │ ├── allOf.json │ ├── anchor.json │ ├── anyOf.json │ ├── boolean_schema.json │ ├── const.json │ ├── contains.json │ ├── content.json │ ├── default.json │ ├── defs.json │ ├── dependentRequired.json │ ├── dependentSchemas.json │ ├── dynamicRef.json │ ├── enum.json │ ├── exclusiveMaximum.json │ ├── exclusiveMinimum.json │ ├── format.json │ ├── id.json │ ├── if-then-else.json │ ├── infinite-loop-detection.json │ ├── items.json │ ├── maxContains.json │ ├── maxItems.json │ ├── maxLength.json │ ├── maxProperties.json │ ├── maximum.json │ ├── minContains.json │ ├── minItems.json │ ├── minLength.json │ ├── minProperties.json │ ├── minimum.json │ ├── multipleOf.json │ ├── not.json │ ├── oneOf.json │ ├── optional │ ├── bignum.json │ ├── ecmascript-regex.json │ ├── float-overflow.json │ ├── format │ │ ├── date-time.json │ │ ├── date.json │ │ ├── duration.json │ │ ├── email.json │ │ ├── hostname.json │ │ ├── idn-email.json │ │ ├── idn-hostname.json │ │ ├── ipv4.json │ │ ├── ipv6.json │ │ ├── iri-reference.json │ │ ├── iri.json │ │ ├── json-pointer.json │ │ ├── regex.json │ │ ├── relative-json-pointer.json │ │ ├── time.json │ │ ├── uri-reference.json │ │ ├── uri-template.json │ │ ├── uri.json │ │ └── uuid.json │ ├── non-bmp-regex.json │ └── refOfUnknownKeyword.json │ ├── pattern.json │ ├── patternProperties.json │ ├── prefixItems.json │ ├── properties.json │ ├── propertyNames.json │ ├── ref.json │ ├── refRemote.json │ ├── required.json │ ├── type.json │ ├── unevaluatedItems.json │ ├── unevaluatedProperties.json │ └── uniqueItems.json ├── test-type-null.schema.json ├── test-unique-item.schema.json ├── test1 ├── person │ └── person.schema.json └── utility.schema.json └── true.schema.json /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | paths-ignore: 9 | - '**.md' 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: actions/setup-java@v4 17 | with: 18 | distribution: temurin 19 | java-version: '8' 20 | cache: maven 21 | - name: Build with mvn package 22 | run: mvn -B --no-transfer-progress package 23 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | deploy: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v4 11 | - uses: actions/setup-java@v4 12 | with: 13 | distribution: temurin 14 | java-version: '8' 15 | cache: maven 16 | server-id: ossrh 17 | server-username: MAVEN_USERNAME 18 | server-password: MAVEN_PASSWORD 19 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 20 | - name: Set up signing key 21 | run: | 22 | # there's probably a better way of doing this! 23 | echo -e "${{ secrets.MAVEN_GPG_PRIVATE_KEY_E }}" | gpg --batch --import 24 | - name: Build and deploy with mvn deploy 25 | env: 26 | MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} 27 | MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} 28 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 29 | run: mvn -B --no-transfer-progress deploy 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .classpath 3 | .project 4 | .settings/ 5 | .idea/ 6 | *.iml 7 | NOTES.md 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Peter Wall 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/kotlin/net/pwall/json/schema/JSONSchemaException.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#) JSONSchemaException.kt 3 | * 4 | * json-kotlin-schema Kotlin implementation of JSON Schema 5 | * Copyright (c) 2020, 2024 Peter Wall 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package net.pwall.json.schema 27 | 28 | import io.kjson.JSONException 29 | 30 | class JSONSchemaException(message: String, key: Any? = null) : JSONException(message, key) { 31 | 32 | constructor(message: String, throwable: Throwable, key: Any? = null) : this(message, key) { 33 | withCause(throwable) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/kotlin/net/pwall/json/schema/output/BasicOutput.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#) BasicOutput.kt 3 | * 4 | * json-kotlin-schema Kotlin implementation of JSON Schema 5 | * Copyright (c) 2020 Peter Wall 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package net.pwall.json.schema.output 27 | 28 | class BasicOutput( 29 | valid: Boolean, 30 | val errors: List? = null 31 | ) : Output(valid) { 32 | 33 | override fun equals(other: Any?): Boolean = this === other || 34 | other is BasicOutput && super.equals(other) && errors == other.errors 35 | 36 | override fun hashCode(): Int = super.hashCode() xor errors.hashCode() 37 | 38 | companion object { 39 | 40 | val trueOutput = BasicOutput(true) 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/kotlin/net/pwall/json/schema/output/Output.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#) Output.kt 3 | * 4 | * json-kotlin-schema Kotlin implementation of JSON Schema 5 | * Copyright (c) 2020 Peter Wall 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package net.pwall.json.schema.output 27 | 28 | open class Output(val valid: Boolean) { 29 | 30 | override fun equals(other: Any?): Boolean { 31 | return this === other || other is Output && valid == other.valid 32 | } 33 | 34 | override fun hashCode() = valid.hashCode() 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/kotlin/net/pwall/json/schema/parser/InputDetails.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#) InputDetails.kt 3 | * 4 | * json-kotlin-schema Kotlin implementation of JSON Schema 5 | * Copyright (c) 2022 Peter Wall 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package net.pwall.json.schema.parser 27 | 28 | import java.io.Reader 29 | 30 | data class InputDetails( 31 | val reader: Reader, 32 | val contentType: String? = null, 33 | ) 34 | -------------------------------------------------------------------------------- /src/test/kotlin/net/pwall/json/schema/testsuite/TestGroup.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#) TestGroup.kt 3 | * 4 | * json-kotlin-schema Kotlin implementation of JSON Schema 5 | * Copyright (c) 2021 Peter Wall 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package net.pwall.json.schema.testsuite 27 | 28 | import io.kjson.JSONValue 29 | 30 | data class TestGroup( 31 | val description: String, 32 | val comment: String? = null, 33 | val schema: JSONValue, 34 | val tests: List 35 | ) 36 | -------------------------------------------------------------------------------- /src/test/kotlin/net/pwall/json/schema/testsuite/TestItem.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#) TestItem.kt 3 | * 4 | * json-kotlin-schema Kotlin implementation of JSON Schema 5 | * Copyright (c) 2021 Peter Wall 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package net.pwall.json.schema.testsuite 27 | 28 | import io.kjson.JSONValue 29 | 30 | data class TestItem( 31 | val description: String, 32 | val comment: String?, 33 | val data: JSONValue?, 34 | val valid: Boolean 35 | ) 36 | -------------------------------------------------------------------------------- /src/test/resources/empty.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "http://pwall.net/schema/test/empty" 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/example-error1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "price": 123, 4 | "tags": [ 5 | "Bar", 6 | "Eek" 7 | ], 8 | "stock": { 9 | "warehouse": 300, 10 | "retail": 20 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/example-error2.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "name": "Foo", 4 | "price": "incorrect", 5 | "tags": [ 6 | "Bar", 7 | "Eek" 8 | ], 9 | "stock": { 10 | "warehouse": 300, 11 | "retail": 20 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/example-error3.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "name": "Foo", 4 | "price": -1, 5 | "tags": [ 6 | "Bar", 7 | "Eek" 8 | ], 9 | "stock": { 10 | "warehouse": 300, 11 | "retail": 20 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/example-error4.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "name": "Foo", 4 | "price": 123, 5 | "tags": [ 6 | "Bar", 7 | "Eek", 8 | 999, 9 | "OK" 10 | ], 11 | "stock": { 12 | "warehouse": 300, 13 | "retail": 20 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "name": "Foo", 4 | "price": 123, 5 | "tags": [ 6 | "Bar", 7 | "Eek" 8 | ], 9 | "stock": { 10 | "warehouse": 300, 11 | "retail": 20 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/example.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test", 4 | "title": "Product", 5 | "type": "object", 6 | "required": ["id", "name", "price"], 7 | "properties": { 8 | "id": { 9 | "type": "number", 10 | "description": "Product identifier" 11 | }, 12 | "name": { 13 | "type": "string", 14 | "description": "Name of the product" 15 | }, 16 | "price": { 17 | "type": "number", 18 | "minimum": 0 19 | }, 20 | "tags": { 21 | "type": "array", 22 | "items": { 23 | "type": "string" 24 | } 25 | }, 26 | "stock": { 27 | "type": "object", 28 | "properties": { 29 | "warehouse": { 30 | "type": "number" 31 | }, 32 | "retail": { 33 | "type": "number" 34 | } 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/resources/example.schema.yaml: -------------------------------------------------------------------------------- 1 | $schema: http://json-schema.org/draft/2019-09/schema 2 | $id: http://pwall.net/test 3 | title: Product 4 | type: object 5 | required: 6 | - id 7 | - name 8 | - price 9 | properties: 10 | id: 11 | type: number 12 | description: Product identifier 13 | name: 14 | type: string 15 | description: Name of the product 16 | price: 17 | type: number 18 | minimum: 0 19 | tags: 20 | type: array 21 | items: 22 | type: string 23 | stock: 24 | type: object 25 | properties: 26 | warehouse: 27 | type: number 28 | retail: 29 | type: number 30 | -------------------------------------------------------------------------------- /src/test/resources/false.schema.json: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /src/test/resources/http/testhttp1.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$id": "http://pwall.net/test/schema/testhttp1.json", 4 | "type": "object", 5 | "properties": { 6 | "xxx": { 7 | "$ref": "testhttp2.json#/$defs/Def1" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/http/testhttp2.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$id": "http://pwall.net/test/schema/testhttp2.json", 4 | "$defs": { 5 | "Def1": { 6 | "type": "object", 7 | "properties": { 8 | "aaa": { 9 | "type": "integer" 10 | } 11 | }, 12 | "required": [ "aaa" ] 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/invalid-1.schema.json: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /src/test/resources/jar/example.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pwall567/json-kotlin-schema/16c651c5ab076fa9b491c856f1b34061cad2338d/src/test/resources/jar/example.jar -------------------------------------------------------------------------------- /src/test/resources/metaschema/meta/content.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2019-09/schema", 3 | "$id": "https://json-schema.org/draft/2019-09/meta/content", 4 | "$vocabulary": { 5 | "https://json-schema.org/draft/2019-09/vocab/content": true 6 | }, 7 | "$recursiveAnchor": true, 8 | 9 | "title": "Content vocabulary meta-schema", 10 | 11 | "type": ["object", "boolean"], 12 | "properties": { 13 | "contentMediaType": { "type": "string" }, 14 | "contentEncoding": { "type": "string" }, 15 | "contentSchema": { "$recursiveRef": "#" } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/metaschema/meta/core.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2019-09/schema", 3 | "$id": "https://json-schema.org/draft/2019-09/meta/core", 4 | "$vocabulary": { 5 | "https://json-schema.org/draft/2019-09/vocab/core": true 6 | }, 7 | "$recursiveAnchor": true, 8 | 9 | "title": "Core vocabulary meta-schema", 10 | "type": ["object", "boolean"], 11 | "properties": { 12 | "$id": { 13 | "type": "string", 14 | "format": "uri-reference", 15 | "$comment": "Non-empty fragments not allowed.", 16 | "pattern": "^[^#]*#?$" 17 | }, 18 | "$schema": { 19 | "type": "string", 20 | "format": "uri" 21 | }, 22 | "$anchor": { 23 | "type": "string", 24 | "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" 25 | }, 26 | "$ref": { 27 | "type": "string", 28 | "format": "uri-reference" 29 | }, 30 | "$recursiveRef": { 31 | "type": "string", 32 | "format": "uri-reference" 33 | }, 34 | "$recursiveAnchor": { 35 | "type": "boolean", 36 | "default": false 37 | }, 38 | "$vocabulary": { 39 | "type": "object", 40 | "propertyNames": { 41 | "type": "string", 42 | "format": "uri" 43 | }, 44 | "additionalProperties": { 45 | "type": "boolean" 46 | } 47 | }, 48 | "$comment": { 49 | "type": "string" 50 | }, 51 | "$defs": { 52 | "type": "object", 53 | "additionalProperties": { "$recursiveRef": "#" }, 54 | "default": {} 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/resources/metaschema/meta/format.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2019-09/schema", 3 | "$id": "https://json-schema.org/draft/2019-09/meta/format", 4 | "$vocabulary": { 5 | "https://json-schema.org/draft/2019-09/vocab/format": true 6 | }, 7 | "$recursiveAnchor": true, 8 | 9 | "title": "Format vocabulary meta-schema", 10 | "type": ["object", "boolean"], 11 | "properties": { 12 | "format": { "type": "string" } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/metaschema/meta/meta-data.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2019-09/schema", 3 | "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", 4 | "$vocabulary": { 5 | "https://json-schema.org/draft/2019-09/vocab/meta-data": true 6 | }, 7 | "$recursiveAnchor": true, 8 | 9 | "title": "Meta-data vocabulary meta-schema", 10 | 11 | "type": ["object", "boolean"], 12 | "properties": { 13 | "title": { 14 | "type": "string" 15 | }, 16 | "description": { 17 | "type": "string" 18 | }, 19 | "default": true, 20 | "deprecated": { 21 | "type": "boolean", 22 | "default": false 23 | }, 24 | "readOnly": { 25 | "type": "boolean", 26 | "default": false 27 | }, 28 | "writeOnly": { 29 | "type": "boolean", 30 | "default": false 31 | }, 32 | "examples": { 33 | "type": "array", 34 | "items": true 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/resources/person-invalid-uuid.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "not-a-uuid", 3 | "name": "Spongebob Squarepants" 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/person.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "524602b2-d49c-11ea-91a8-07b393e1eee3", 3 | "name": "Spongebob Squarepants" 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/test-additional-false.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-additional-false", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string" 9 | } 10 | }, 11 | "additionalProperties": false 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/test-additional.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-additional", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string" 9 | } 10 | }, 11 | "additionalProperties": { 12 | "type": "integer", 13 | "minimum": 0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/test-anyof.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-anyof", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "anyOf": [ 9 | { 10 | "const": "AAA" 11 | }, 12 | { 13 | "format": "date" 14 | } 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/test-const.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-const", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "const": "AAA" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/test-contains-minmax.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-contains-minmax", 4 | "type": "array", 5 | "items": { 6 | "type": "integer" 7 | }, 8 | "contains": { 9 | "const": 5 10 | }, 11 | "minContains": 2, 12 | "maxContains": 3 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/test-contains.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-contains", 4 | "type": "array", 5 | "items": { 6 | "type": "integer" 7 | }, 8 | "contains": { 9 | "const": 5 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/test-custom-validator.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-custom", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string", 9 | "x-test": "not-empty" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/test-default-invalid.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-default-invalid", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "integer", 9 | "minimum": 20, 10 | "default": 15 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/test-default-valid.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-default-valid", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "integer", 9 | "minimum": 20, 10 | "default": 25 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/test-description-ref.schema.yaml: -------------------------------------------------------------------------------- 1 | $schema: http://json-schema.org/draft/2019-09/schema 2 | title: Product 3 | description: 4 | $ref: test-description-text.txt 5 | type: object 6 | -------------------------------------------------------------------------------- /src/test/resources/test-description-text.txt: -------------------------------------------------------------------------------- 1 | This is an example of external text. 2 | It has two lines. 3 | -------------------------------------------------------------------------------- /src/test/resources/test-domestic-address.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2019-09/schema", 3 | "$id": "https://pwall.net/test-domestic-address", 4 | "title": "Domestic Address", 5 | "type": "object", 6 | "properties": { 7 | "line1": { 8 | "type": "string", 9 | "minLength": 1 10 | }, 11 | "line2": { 12 | "type": "string", 13 | "minLength": 1 14 | }, 15 | "state": { 16 | "type": "string", 17 | "enum": [ "NSW", "QLD", "VIC", "TAS", "SA", "WA", "ACT", "NT" ] 18 | }, 19 | "postcode": { 20 | "type": "string", 21 | "pattern": "^[0-9]{4}$" 22 | } 23 | }, 24 | "required": [ "line1", "state", "postcode" ] 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/test-enum.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-enum", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "enum": [ "AAA", "BBB", "CCC" ] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/test-example-invalid-2.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-example-invalid-2", 4 | "title": "Dummy", 5 | "type": "integer", 6 | "minimum": 20, 7 | "example": 19 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/test-example-invalid.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-example-invalid", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string", 9 | "minLength": 3, 10 | "maxLength": 10 11 | } 12 | }, 13 | "example": { 14 | "aaa": "NO" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/test-example-valid.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-example-valid", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string", 9 | "minLength": 3, 10 | "maxLength": 10 11 | } 12 | }, 13 | "example": { 14 | "aaa": "GOOD" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/test-examples-invalid.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-examples-invalid", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string", 9 | "minLength": 3, 10 | "maxLength": 10 11 | }, 12 | "bbb": { 13 | "type": "integer", 14 | "minimum": 0, 15 | "examples": [ -1 ] 16 | } 17 | }, 18 | "required": [ "aaa" ], 19 | "additionalProperties": false, 20 | "examples": [ 21 | { 22 | "aaa": "GOOD", 23 | "bbb": 10 24 | }, 25 | { 26 | "aaa": "BETTER" 27 | }, 28 | { 29 | "aaa": "NO" 30 | }, 31 | { 32 | "bbb": -2 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /src/test/resources/test-examples-valid.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-examples-valid", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string", 9 | "minLength": 3, 10 | "maxLength": 10 11 | }, 12 | "bbb": { 13 | "type": "integer", 14 | "minimum": 0, 15 | "examples": [ 99 ] 16 | } 17 | }, 18 | "required": [ "aaa" ], 19 | "additionalProperties": false, 20 | "examples": [ 21 | { 22 | "aaa": "GOOD", 23 | "bbb": 10 24 | }, 25 | { 26 | "aaa": "BETTER" 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/test-if-then-else.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-if-then-else", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string" 9 | } 10 | }, 11 | "if": { 12 | "properties": { 13 | "aaa": { 14 | "const": "U" 15 | } 16 | } 17 | }, 18 | "then": { 19 | "properties": { 20 | "bbb": { 21 | "format": "uuid" 22 | } 23 | } 24 | }, 25 | "else": { 26 | "properties": { 27 | "bbb": { 28 | "format": "date-time" 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/test-international-address.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2019-09/schema", 3 | "$id": "https://pwall.net/test-international-address", 4 | "title": "Domestic Address", 5 | "type": "object", 6 | "properties": { 7 | "line1": { 8 | "type": "string", 9 | "minLength": 1 10 | }, 11 | "line2": { 12 | "type": "string", 13 | "minLength": 1 14 | }, 15 | "line3": { 16 | "type": "string", 17 | "minLength": 1 18 | }, 19 | "line4": { 20 | "type": "string", 21 | "minLength": 1 22 | }, 23 | "country": { 24 | "type": "string", 25 | "minLength": 1 26 | } 27 | }, 28 | "required": [ "line1", "line2", "country" ] 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/test-item-array.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-item-array", 4 | "type": "object", 5 | "properties": { 6 | "aaa": { 7 | "type": "array", 8 | "items": [ 9 | { 10 | "type": "integer", 11 | "minimum": 0, 12 | "maximum": 9 13 | }, 14 | { 15 | "type": "integer", 16 | "minimum": 10 17 | } 18 | ], 19 | "additionalItems": { 20 | "type": "integer", 21 | "exclusiveMaximum": 0 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/test-item.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-item", 4 | "type": "object", 5 | "properties": { 6 | "aaa": { 7 | "type": "array", 8 | "items": { 9 | "type": "integer", 10 | "minimum": 0 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/test-nonstandard-format.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-nonstandard-format", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "type": "string", 9 | "format": "non-standard" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/test-not.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-not", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "not": { 9 | "const": "AAA" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/test-oneof.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2019-09/schema", 3 | "$id": "https://pwall.net/test-oneof", 4 | "title": "Customer", 5 | "type": "object", 6 | "properties": { 7 | "id": { 8 | "type": "string", 9 | "format": "uuid" 10 | }, 11 | "name": { 12 | "type": "string", 13 | "minLength": 1 14 | }, 15 | "customerType": { 16 | "type": "string" 17 | } 18 | }, 19 | "required": [ "id", "name", "customerType" ], 20 | "oneOf": [ 21 | { 22 | "properties": { 23 | "customerType": { 24 | "const": "domestic" 25 | }, 26 | "domesticAddress": { 27 | "$ref": "test-domestic-address.schema.json" 28 | } 29 | }, 30 | "required": [ "domesticAddress" ] 31 | }, 32 | { 33 | "properties": { 34 | "customerType": { 35 | "const": "international" 36 | }, 37 | "internationalAddress": { 38 | "$ref": "test-international-address.schema.json" 39 | } 40 | }, 41 | "required": [ "internationalAddress" ] 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /src/test/resources/test-pattern-properties.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-pattern", 4 | "type": "object", 5 | "properties": { 6 | "aaa": { 7 | "type": "string" 8 | } 9 | }, 10 | "patternProperties": { 11 | "^field[0-9]{1,3}$": { 12 | "type": "integer", 13 | "minimum": 10 14 | } 15 | }, 16 | "additionalProperties": { 17 | "type": "integer", 18 | "minimum": 20 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/test-property-names.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-property-names", 4 | "type": "object", 5 | "propertyNames": { 6 | "maxLength": 3 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/test-ref.json: -------------------------------------------------------------------------------- 1 | { 2 | "aaa": 123, 3 | "bbb": "xyz", 4 | "ccc": 456 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/test-ref.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-ref", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "$ref": "#/$defs/amount" 9 | }, 10 | "bbb": { 11 | "$ref": "#/$defs/amount" 12 | }, 13 | "ccc": { 14 | "$ref": "#/$defs/amount" 15 | } 16 | }, 17 | "$defs": { 18 | "amount": { 19 | "type": "number" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/test-string-format.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-string-format", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "dateTimeTest": { 8 | "format": "date-time" 9 | }, 10 | "dateTest": { 11 | "format": "date" 12 | }, 13 | "timeTest": { 14 | "format": "time" 15 | }, 16 | "durationTest": { 17 | "format": "duration" 18 | }, 19 | "uuidTest": { 20 | "format": "uuid" 21 | }, 22 | "uriTest": { 23 | "format": "uri" 24 | }, 25 | "uriReferenceTest": { 26 | "format": "uri-reference" 27 | }, 28 | "uriTemplateTest": { 29 | "format": "uri-template" 30 | }, 31 | "ipv4Test": { 32 | "format": "ipv4" 33 | }, 34 | "ipv6Test": { 35 | "format": "ipv6" 36 | }, 37 | "jsonPointerTest": { 38 | "format": "json-pointer" 39 | }, 40 | "relativeJsonPointerTest": { 41 | "format": "relative-json-pointer" 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/resources/test-string-length.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-string-length", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "minLength": 3, 9 | "maxLength": 10 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/test-string-pattern.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-string-pattern", 4 | "title": "Dummy", 5 | "type": "object", 6 | "properties": { 7 | "aaa": { 8 | "pattern": "^[A-Z][0-9]{3}$" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Julian Berman 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/remotes/baseUriChange/folderInteger.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "integer" 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/remotes/baseUriChangeFolder/folderInteger.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "integer" 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/remotes/baseUriChangeFolderInSubschema/folderInteger.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "integer" 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/remotes/integer.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "integer" 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/remotes/name-defs.json: -------------------------------------------------------------------------------- 1 | { 2 | "$defs": { 3 | "orNull": { 4 | "anyOf": [ 5 | { 6 | "type": "null" 7 | }, 8 | { 9 | "$ref": "#" 10 | } 11 | ] 12 | } 13 | }, 14 | "type": "string" 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/remotes/name.json: -------------------------------------------------------------------------------- 1 | { 2 | "definitions": { 3 | "orNull": { 4 | "anyOf": [ 5 | { 6 | "type": "null" 7 | }, 8 | { 9 | "$ref": "#" 10 | } 11 | ] 12 | } 13 | }, 14 | "type": "string" 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/remotes/subSchemas-defs.json: -------------------------------------------------------------------------------- 1 | { 2 | "$defs": { 3 | "integer": { 4 | "type": "integer" 5 | }, 6 | "refToInteger": { 7 | "$ref": "#/$defs/integer" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/remotes/subSchemas.json: -------------------------------------------------------------------------------- 1 | { 2 | "integer": { 3 | "type": "integer" 4 | }, 5 | "refToInteger": { 6 | "$ref": "#/integer" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/defs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validate definition against metaschema", 4 | "schema": {"$ref": "https://json-schema.org/draft/2019-09/schema"}, 5 | "tests": [ 6 | { 7 | "description": "valid definition schema", 8 | "data": {"$defs": {"foo": {"type": "integer"}}}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "invalid definition schema", 13 | "data": {"$defs": {"foo": {"type": 1}}}, 14 | "valid": false 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/exclusiveMaximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMaximum validation", 4 | "schema": { 5 | "exclusiveMaximum": 3.0 6 | }, 7 | "tests": [ 8 | { 9 | "description": "below the exclusiveMaximum is valid", 10 | "data": 2.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 3.0, 16 | "valid": false 17 | }, 18 | { 19 | "description": "above the exclusiveMaximum is invalid", 20 | "data": 3.5, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/exclusiveMinimum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMinimum validation", 4 | "schema": { 5 | "exclusiveMinimum": 1.1 6 | }, 7 | "tests": [ 8 | { 9 | "description": "above the exclusiveMinimum is valid", 10 | "data": 1.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 1.1, 16 | "valid": false 17 | }, 18 | { 19 | "description": "below the exclusiveMinimum is invalid", 20 | "data": 0.6, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/infinite-loop-detection.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop", 4 | "schema": { 5 | "$defs": { 6 | "int": { "type": "integer" } 7 | }, 8 | "allOf": [ 9 | { 10 | "properties": { 11 | "foo": { 12 | "$ref": "#/$defs/int" 13 | } 14 | } 15 | }, 16 | { 17 | "additionalProperties": { 18 | "$ref": "#/$defs/int" 19 | } 20 | } 21 | ] 22 | }, 23 | "tests": [ 24 | { 25 | "description": "passing case", 26 | "data": { "foo": 1 }, 27 | "valid": true 28 | }, 29 | { 30 | "description": "failing case", 31 | "data": { "foo": "a string" }, 32 | "valid": false 33 | } 34 | ] 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/maxItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxItems validation", 4 | "schema": {"maxItems": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": [1], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1, 2], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": [1, 2, 3], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "foobar", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/maxLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxLength validation", 4 | "schema": {"maxLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": "f", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": "foo", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 100, 24 | "valid": true 25 | }, 26 | { 27 | "description": "two supplementary Unicode code points is long enough", 28 | "data": "\uD83D\uDCA9\uD83D\uDCA9", 29 | "valid": true 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/maxProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxProperties validation", 4 | "schema": {"maxProperties": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": {"foo": 1}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1, "bar": 2}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": {"foo": 1, "bar": 2, "baz": 3}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [1, 2, 3], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "foobar", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | }, 38 | { 39 | "description": "maxProperties = 0 means the object is empty", 40 | "schema": { "maxProperties": 0 }, 41 | "tests": [ 42 | { 43 | "description": "no properties is valid", 44 | "data": {}, 45 | "valid": true 46 | }, 47 | { 48 | "description": "one property is invalid", 49 | "data": { "foo": 1 }, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/maximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maximum validation", 4 | "schema": {"maximum": 3.0}, 5 | "tests": [ 6 | { 7 | "description": "below the maximum is valid", 8 | "data": 2.6, 9 | "valid": true 10 | }, 11 | { 12 | "description": "boundary point is valid", 13 | "data": 3.0, 14 | "valid": true 15 | }, 16 | { 17 | "description": "above the maximum is invalid", 18 | "data": 3.5, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-numbers", 23 | "data": "x", 24 | "valid": true 25 | } 26 | ] 27 | }, 28 | { 29 | "description": "maximum validation with unsigned integer", 30 | "schema": {"maximum": 300}, 31 | "tests": [ 32 | { 33 | "description": "below the maximum is invalid", 34 | "data": 299.97, 35 | "valid": true 36 | }, 37 | { 38 | "description": "boundary point integer is valid", 39 | "data": 300, 40 | "valid": true 41 | }, 42 | { 43 | "description": "boundary point float is valid", 44 | "data": 300.00, 45 | "valid": true 46 | }, 47 | { 48 | "description": "above the maximum is invalid", 49 | "data": 300.5, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/minItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minItems validation", 4 | "schema": {"minItems": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": [1, 2], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": [], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/minLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minLength validation", 4 | "schema": {"minLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": "foo", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": "f", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 1, 24 | "valid": true 25 | }, 26 | { 27 | "description": "one supplementary Unicode code point is not long enough", 28 | "data": "\uD83D\uDCA9", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/minProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minProperties validation", 4 | "schema": {"minProperties": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": {"foo": 1, "bar": 2}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": {}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/float-overflow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "all integers are multiples of 0.5, if overflow is handled", 4 | "schema": {"type": "integer", "multipleOf": 0.5}, 5 | "tests": [ 6 | { 7 | "description": "valid if optional overflow handling is implemented", 8 | "data": 1e308, 9 | "valid": true 10 | } 11 | ] 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/date.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of date strings", 4 | "schema": {"format": "date"}, 5 | "tests": [ 6 | { 7 | "description": "a valid date string", 8 | "data": "1963-06-19", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid date-time string", 13 | "data": "06/19/1963", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "2013-350", 19 | "valid": false 20 | }, 21 | { 22 | "description": "invalidates non-padded month dates", 23 | "data": "1998-1-20", 24 | "valid": false 25 | }, 26 | { 27 | "description": "invalidates non-padded day dates", 28 | "data": "1998-01-1", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of e-mail addresses", 4 | "schema": {"format": "email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid e-mail address", 8 | "data": "joe.bloggs@example.com", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "tilde in local part is valid", 18 | "data": "te~st@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "tilde before local part is valid", 23 | "data": "~test@example.com", 24 | "valid": true 25 | }, 26 | { 27 | "description": "tilde after local part is valid", 28 | "data": "test~@example.com", 29 | "valid": true 30 | }, 31 | { 32 | "description": "dot before local part is not valid", 33 | "data": ".test@example.com", 34 | "valid": false 35 | }, 36 | { 37 | "description": "dot after local part is not valid", 38 | "data": "test.@example.com", 39 | "valid": false 40 | }, 41 | { 42 | "description": "two separated dots inside local part are valid", 43 | "data": "te.s.t@example.com", 44 | "valid": true 45 | }, 46 | { 47 | "description": "two subsequent dots inside local part are not valid", 48 | "data": "te..st@example.com", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/idn-email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of an internationalized e-mail addresses", 4 | "schema": {"format": "idn-email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid idn e-mail (example@example.test in Hangul)", 8 | "data": "실례@실례.테스트", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid idn e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid e-mail address", 18 | "data": "joe.bloggs@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid e-mail address", 23 | "data": "2962", 24 | "valid": false 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/iri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of IRI References", 4 | "schema": {"format": "iri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid IRI", 8 | "data": "http://ƒøø.ßår/?∂éœ=πîx#πîüx", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative IRI Reference", 13 | "data": "//ƒøø.ßår/?∂éœ=πîx#πîüx", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative IRI Reference", 18 | "data": "/âππ", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid IRI Reference", 23 | "data": "\\\\WINDOWS\\filëßåré", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid IRI Reference", 28 | "data": "âππ", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid IRI fragment", 33 | "data": "#ƒrägmênt", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid IRI fragment", 38 | "data": "#ƒräg\\mênt", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/regex.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of regular expressions", 4 | "schema": {"format": "regex"}, 5 | "tests": [ 6 | { 7 | "description": "a valid regular expression", 8 | "data": "([abc])+\\s+$", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a regular expression with unclosed parens is invalid", 13 | "data": "^(abc]", 14 | "valid": false 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/relative-json-pointer.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of Relative JSON Pointers (RJP)", 4 | "schema": {"format": "relative-json-pointer"}, 5 | "tests": [ 6 | { 7 | "description": "a valid upwards RJP", 8 | "data": "1", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid downwards RJP", 13 | "data": "0/foo/bar", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid up and then down RJP, with array index", 18 | "data": "2/0/baz/1/zip", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid RJP taking the member or index name", 23 | "data": "0#", 24 | "valid": true 25 | }, 26 | { 27 | "description": "an invalid RJP that is a valid JSON Pointer", 28 | "data": "/foo/bar", 29 | "valid": false 30 | }, 31 | { 32 | "description": "negative prefix", 33 | "data": "-1/foo/bar", 34 | "valid": false 35 | }, 36 | { 37 | "description": "## is not a valid json-pointer", 38 | "data": "0##", 39 | "valid": false 40 | }, 41 | { 42 | "description": "zero cannot be followed by other digits, plus json-pointer", 43 | "data": "01/a", 44 | "valid": false 45 | }, 46 | { 47 | "description": "zero cannot be followed by other digits, plus octothorpe", 48 | "data": "01#", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/time.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of time strings", 4 | "schema": {"format": "time"}, 5 | "tests": [ 6 | { 7 | "description": "a valid time string", 8 | "data": "08:30:06.283185Z", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid time string", 13 | "data": "08:30:06 PST", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "01:01:01,1111", 19 | "valid": false 20 | } 21 | ] 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/uri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of URI References", 4 | "schema": {"format": "uri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid URI", 8 | "data": "http://foo.bar/?baz=qux#quux", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative URI Reference", 13 | "data": "//foo.bar/?baz=qux#quux", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative URI Reference", 18 | "data": "/abc", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid URI Reference", 23 | "data": "\\\\WINDOWS\\fileshare", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid URI Reference", 28 | "data": "abc", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid URI fragment", 33 | "data": "#fragment", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid URI fragment", 38 | "data": "#frag\\ment", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/format/uri-template.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "format: uri-template", 4 | "schema": {"format": "uri-template"}, 5 | "tests": [ 6 | { 7 | "description": "a valid uri-template", 8 | "data": "http://example.com/dictionary/{term:1}/{term}", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid uri-template", 13 | "data": "http://example.com/dictionary/{term:1}/{term", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid uri-template without variables", 18 | "data": "http://example.com/dictionary", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid relative uri-template", 23 | "data": "dictionary/{term:1}/{term}", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/optional/refOfUnknownKeyword.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "reference of a root arbitrary keyword ", 4 | "schema": { 5 | "unknown-keyword": {"type": "integer"}, 6 | "properties": { 7 | "bar": {"$ref": "#/unknown-keyword"} 8 | } 9 | }, 10 | "tests": [ 11 | { 12 | "description": "match", 13 | "data": {"bar": 3}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "mismatch", 18 | "data": {"bar": true}, 19 | "valid": false 20 | } 21 | ] 22 | }, 23 | { 24 | "description": "reference of an arbitrary keyword of a sub-schema", 25 | "schema": { 26 | "properties": { 27 | "foo": {"unknown-keyword": {"type": "integer"}}, 28 | "bar": {"$ref": "#/properties/foo/unknown-keyword"} 29 | } 30 | }, 31 | "tests": [ 32 | { 33 | "description": "match", 34 | "data": {"bar": 3}, 35 | "valid": true 36 | }, 37 | { 38 | "description": "mismatch", 39 | "data": {"bar": true}, 40 | "valid": false 41 | } 42 | ] 43 | } 44 | ] 45 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2019-09/pattern.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "pattern validation", 4 | "schema": {"pattern": "^a*$"}, 5 | "tests": [ 6 | { 7 | "description": "a matching pattern is valid", 8 | "data": "aaa", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a non-matching pattern is invalid", 13 | "data": "abc", 14 | "valid": false 15 | }, 16 | { 17 | "description": "ignores booleans", 18 | "data": true, 19 | "valid": true 20 | }, 21 | { 22 | "description": "ignores integers", 23 | "data": 123, 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores floats", 28 | "data": 1.0, 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores objects", 33 | "data": {}, 34 | "valid": true 35 | }, 36 | { 37 | "description": "ignores arrays", 38 | "data": [], 39 | "valid": true 40 | }, 41 | { 42 | "description": "ignores null", 43 | "data": null, 44 | "valid": true 45 | } 46 | ] 47 | }, 48 | { 49 | "description": "pattern is not anchored", 50 | "schema": {"pattern": "a+"}, 51 | "tests": [ 52 | { 53 | "description": "matches a substring", 54 | "data": "xxaayy", 55 | "valid": true 56 | } 57 | ] 58 | } 59 | ] 60 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/defs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validate definition against metaschema", 4 | "schema": { 5 | "$ref": "https://json-schema.org/draft/2020-12/schema" 6 | }, 7 | "tests": [ 8 | { 9 | "description": "valid definition schema", 10 | "data": {"$defs": {"foo": {"type": "integer"}}}, 11 | "valid": true 12 | }, 13 | { 14 | "description": "invalid definition schema", 15 | "data": {"$defs": {"foo": {"type": 1}}}, 16 | "valid": false 17 | } 18 | ] 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/exclusiveMaximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMaximum validation", 4 | "schema": { 5 | "exclusiveMaximum": 3.0 6 | }, 7 | "tests": [ 8 | { 9 | "description": "below the exclusiveMaximum is valid", 10 | "data": 2.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 3.0, 16 | "valid": false 17 | }, 18 | { 19 | "description": "above the exclusiveMaximum is invalid", 20 | "data": 3.5, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/exclusiveMinimum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMinimum validation", 4 | "schema": { 5 | "exclusiveMinimum": 1.1 6 | }, 7 | "tests": [ 8 | { 9 | "description": "above the exclusiveMinimum is valid", 10 | "data": 1.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 1.1, 16 | "valid": false 17 | }, 18 | { 19 | "description": "below the exclusiveMinimum is invalid", 20 | "data": 0.6, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/infinite-loop-detection.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop", 4 | "schema": { 5 | "$defs": { 6 | "int": { "type": "integer" } 7 | }, 8 | "allOf": [ 9 | { 10 | "properties": { 11 | "foo": { 12 | "$ref": "#/$defs/int" 13 | } 14 | } 15 | }, 16 | { 17 | "additionalProperties": { 18 | "$ref": "#/$defs/int" 19 | } 20 | } 21 | ] 22 | }, 23 | "tests": [ 24 | { 25 | "description": "passing case", 26 | "data": { "foo": 1 }, 27 | "valid": true 28 | }, 29 | { 30 | "description": "failing case", 31 | "data": { "foo": "a string" }, 32 | "valid": false 33 | } 34 | ] 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/maxItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxItems validation", 4 | "schema": {"maxItems": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": [1], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1, 2], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": [1, 2, 3], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "foobar", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/maxLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxLength validation", 4 | "schema": {"maxLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": "f", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": "foo", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 100, 24 | "valid": true 25 | }, 26 | { 27 | "description": "two supplementary Unicode code points is long enough", 28 | "data": "\uD83D\uDCA9\uD83D\uDCA9", 29 | "valid": true 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/maxProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxProperties validation", 4 | "schema": {"maxProperties": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": {"foo": 1}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1, "bar": 2}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": {"foo": 1, "bar": 2, "baz": 3}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [1, 2, 3], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "foobar", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | }, 38 | { 39 | "description": "maxProperties = 0 means the object is empty", 40 | "schema": { "maxProperties": 0 }, 41 | "tests": [ 42 | { 43 | "description": "no properties is valid", 44 | "data": {}, 45 | "valid": true 46 | }, 47 | { 48 | "description": "one property is invalid", 49 | "data": { "foo": 1 }, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/maximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maximum validation", 4 | "schema": {"maximum": 3.0}, 5 | "tests": [ 6 | { 7 | "description": "below the maximum is valid", 8 | "data": 2.6, 9 | "valid": true 10 | }, 11 | { 12 | "description": "boundary point is valid", 13 | "data": 3.0, 14 | "valid": true 15 | }, 16 | { 17 | "description": "above the maximum is invalid", 18 | "data": 3.5, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-numbers", 23 | "data": "x", 24 | "valid": true 25 | } 26 | ] 27 | }, 28 | { 29 | "description": "maximum validation with unsigned integer", 30 | "schema": {"maximum": 300}, 31 | "tests": [ 32 | { 33 | "description": "below the maximum is invalid", 34 | "data": 299.97, 35 | "valid": true 36 | }, 37 | { 38 | "description": "boundary point integer is valid", 39 | "data": 300, 40 | "valid": true 41 | }, 42 | { 43 | "description": "boundary point float is valid", 44 | "data": 300.00, 45 | "valid": true 46 | }, 47 | { 48 | "description": "above the maximum is invalid", 49 | "data": 300.5, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/minItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minItems validation", 4 | "schema": {"minItems": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": [1, 2], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": [], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/minLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minLength validation", 4 | "schema": {"minLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": "foo", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": "f", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 1, 24 | "valid": true 25 | }, 26 | { 27 | "description": "one supplementary Unicode code point is not long enough", 28 | "data": "\uD83D\uDCA9", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/minProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minProperties validation", 4 | "schema": {"minProperties": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": {"foo": 1, "bar": 2}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": {}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/float-overflow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "all integers are multiples of 0.5, if overflow is handled", 4 | "schema": {"type": "integer", "multipleOf": 0.5}, 5 | "tests": [ 6 | { 7 | "description": "valid if optional overflow handling is implemented", 8 | "data": 1e308, 9 | "valid": true 10 | } 11 | ] 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/date.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of date strings", 4 | "schema": {"format": "date"}, 5 | "tests": [ 6 | { 7 | "description": "a valid date string", 8 | "data": "1963-06-19", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid date-time string", 13 | "data": "06/19/1963", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "2013-350", 19 | "valid": false 20 | }, 21 | { 22 | "description": "invalidates non-padded month dates", 23 | "data": "1998-1-20", 24 | "valid": false 25 | }, 26 | { 27 | "description": "invalidates non-padded day dates", 28 | "data": "1998-01-1", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of e-mail addresses", 4 | "schema": {"format": "email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid e-mail address", 8 | "data": "joe.bloggs@example.com", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "tilde in local part is valid", 18 | "data": "te~st@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "tilde before local part is valid", 23 | "data": "~test@example.com", 24 | "valid": true 25 | }, 26 | { 27 | "description": "tilde after local part is valid", 28 | "data": "test~@example.com", 29 | "valid": true 30 | }, 31 | { 32 | "description": "dot before local part is not valid", 33 | "data": ".test@example.com", 34 | "valid": false 35 | }, 36 | { 37 | "description": "dot after local part is not valid", 38 | "data": "test.@example.com", 39 | "valid": false 40 | }, 41 | { 42 | "description": "two separated dots inside local part are valid", 43 | "data": "te.s.t@example.com", 44 | "valid": true 45 | }, 46 | { 47 | "description": "two subsequent dots inside local part are not valid", 48 | "data": "te..st@example.com", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/idn-email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of an internationalized e-mail addresses", 4 | "schema": {"format": "idn-email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid idn e-mail (example@example.test in Hangul)", 8 | "data": "실례@실례.테스트", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid idn e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid e-mail address", 18 | "data": "joe.bloggs@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid e-mail address", 23 | "data": "2962", 24 | "valid": false 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/iri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of IRI References", 4 | "schema": {"format": "iri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid IRI", 8 | "data": "http://ƒøø.ßår/?∂éœ=πîx#πîüx", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative IRI Reference", 13 | "data": "//ƒøø.ßår/?∂éœ=πîx#πîüx", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative IRI Reference", 18 | "data": "/âππ", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid IRI Reference", 23 | "data": "\\\\WINDOWS\\filëßåré", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid IRI Reference", 28 | "data": "âππ", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid IRI fragment", 33 | "data": "#ƒrägmênt", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid IRI fragment", 38 | "data": "#ƒräg\\mênt", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/regex.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of regular expressions", 4 | "schema": {"format": "regex"}, 5 | "tests": [ 6 | { 7 | "description": "a valid regular expression", 8 | "data": "([abc])+\\s+$", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a regular expression with unclosed parens is invalid", 13 | "data": "^(abc]", 14 | "valid": false 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/relative-json-pointer.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of Relative JSON Pointers (RJP)", 4 | "schema": {"format": "relative-json-pointer"}, 5 | "tests": [ 6 | { 7 | "description": "a valid upwards RJP", 8 | "data": "1", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid downwards RJP", 13 | "data": "0/foo/bar", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid up and then down RJP, with array index", 18 | "data": "2/0/baz/1/zip", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid RJP taking the member or index name", 23 | "data": "0#", 24 | "valid": true 25 | }, 26 | { 27 | "description": "an invalid RJP that is a valid JSON Pointer", 28 | "data": "/foo/bar", 29 | "valid": false 30 | }, 31 | { 32 | "description": "negative prefix", 33 | "data": "-1/foo/bar", 34 | "valid": false 35 | }, 36 | { 37 | "description": "## is not a valid json-pointer", 38 | "data": "0##", 39 | "valid": false 40 | }, 41 | { 42 | "description": "zero cannot be followed by other digits, plus json-pointer", 43 | "data": "01/a", 44 | "valid": false 45 | }, 46 | { 47 | "description": "zero cannot be followed by other digits, plus octothorpe", 48 | "data": "01#", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/time.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of time strings", 4 | "schema": {"format": "time"}, 5 | "tests": [ 6 | { 7 | "description": "a valid time string", 8 | "data": "08:30:06.283185Z", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid time string", 13 | "data": "08:30:06 PST", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "01:01:01,1111", 19 | "valid": false 20 | } 21 | ] 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/uri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of URI References", 4 | "schema": {"format": "uri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid URI", 8 | "data": "http://foo.bar/?baz=qux#quux", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative URI Reference", 13 | "data": "//foo.bar/?baz=qux#quux", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative URI Reference", 18 | "data": "/abc", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid URI Reference", 23 | "data": "\\\\WINDOWS\\fileshare", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid URI Reference", 28 | "data": "abc", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid URI fragment", 33 | "data": "#fragment", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid URI fragment", 38 | "data": "#frag\\ment", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/format/uri-template.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "format: uri-template", 4 | "schema": {"format": "uri-template"}, 5 | "tests": [ 6 | { 7 | "description": "a valid uri-template", 8 | "data": "http://example.com/dictionary/{term:1}/{term}", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid uri-template", 13 | "data": "http://example.com/dictionary/{term:1}/{term", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid uri-template without variables", 18 | "data": "http://example.com/dictionary", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid relative uri-template", 23 | "data": "dictionary/{term:1}/{term}", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/optional/refOfUnknownKeyword.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "reference of a root arbitrary keyword ", 4 | "schema": { 5 | "unknown-keyword": {"type": "integer"}, 6 | "properties": { 7 | "bar": {"$ref": "#/unknown-keyword"} 8 | } 9 | }, 10 | "tests": [ 11 | { 12 | "description": "match", 13 | "data": {"bar": 3}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "mismatch", 18 | "data": {"bar": true}, 19 | "valid": false 20 | } 21 | ] 22 | }, 23 | { 24 | "description": "reference of an arbitrary keyword of a sub-schema", 25 | "schema": { 26 | "properties": { 27 | "foo": {"unknown-keyword": {"type": "integer"}}, 28 | "bar": {"$ref": "#/properties/foo/unknown-keyword"} 29 | } 30 | }, 31 | "tests": [ 32 | { 33 | "description": "match", 34 | "data": {"bar": 3}, 35 | "valid": true 36 | }, 37 | { 38 | "description": "mismatch", 39 | "data": {"bar": true}, 40 | "valid": false 41 | } 42 | ] 43 | } 44 | ] 45 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft2020-12/pattern.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "pattern validation", 4 | "schema": {"pattern": "^a*$"}, 5 | "tests": [ 6 | { 7 | "description": "a matching pattern is valid", 8 | "data": "aaa", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a non-matching pattern is invalid", 13 | "data": "abc", 14 | "valid": false 15 | }, 16 | { 17 | "description": "ignores booleans", 18 | "data": true, 19 | "valid": true 20 | }, 21 | { 22 | "description": "ignores integers", 23 | "data": 123, 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores floats", 28 | "data": 1.0, 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores objects", 33 | "data": {}, 34 | "valid": true 35 | }, 36 | { 37 | "description": "ignores arrays", 38 | "data": [], 39 | "valid": true 40 | }, 41 | { 42 | "description": "ignores null", 43 | "data": null, 44 | "valid": true 45 | } 46 | ] 47 | }, 48 | { 49 | "description": "pattern is not anchored", 50 | "schema": {"pattern": "a+"}, 51 | "tests": [ 52 | { 53 | "description": "matches a substring", 54 | "data": "xxaayy", 55 | "valid": true 56 | } 57 | ] 58 | } 59 | ] 60 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/divisibleBy.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "by int", 4 | "schema": {"divisibleBy": 2}, 5 | "tests": [ 6 | { 7 | "description": "int by int", 8 | "data": 10, 9 | "valid": true 10 | }, 11 | { 12 | "description": "int by int fail", 13 | "data": 7, 14 | "valid": false 15 | }, 16 | { 17 | "description": "ignores non-numbers", 18 | "data": "foo", 19 | "valid": true 20 | } 21 | ] 22 | }, 23 | { 24 | "description": "by number", 25 | "schema": {"divisibleBy": 1.5}, 26 | "tests": [ 27 | { 28 | "description": "zero is divisible by anything (except 0)", 29 | "data": 0, 30 | "valid": true 31 | }, 32 | { 33 | "description": "4.5 is divisible by 1.5", 34 | "data": 4.5, 35 | "valid": true 36 | }, 37 | { 38 | "description": "35 is not divisible by 1.5", 39 | "data": 35, 40 | "valid": false 41 | } 42 | ] 43 | }, 44 | { 45 | "description": "by small number", 46 | "schema": {"divisibleBy": 0.0001}, 47 | "tests": [ 48 | { 49 | "description": "0.0075 is divisible by 0.0001", 50 | "data": 0.0075, 51 | "valid": true 52 | }, 53 | { 54 | "description": "0.00751 is not divisible by 0.0001", 55 | "data": 0.00751, 56 | "valid": false 57 | } 58 | ] 59 | } 60 | ] 61 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/infinite-loop-detection.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop", 4 | "schema": { 5 | "definitions": { 6 | "int": { "type": "integer" } 7 | }, 8 | "properties": { 9 | "foo": { 10 | "$ref": "#/definitions/int" 11 | } 12 | }, 13 | "extends": { 14 | "additionalProperties": { 15 | "$ref": "#/definitions/int" 16 | } 17 | } 18 | }, 19 | "tests": [ 20 | { 21 | "description": "passing case", 22 | "data": { "foo": 1 }, 23 | "valid": true 24 | }, 25 | { 26 | "description": "failing case", 27 | "data": { "foo": "a string" }, 28 | "valid": false 29 | } 30 | ] 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/items.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "a schema given for items", 4 | "schema": { 5 | "items": {"type": "integer"} 6 | }, 7 | "tests": [ 8 | { 9 | "description": "valid items", 10 | "data": [ 1, 2, 3 ], 11 | "valid": true 12 | }, 13 | { 14 | "description": "wrong type of items", 15 | "data": [1, "x"], 16 | "valid": false 17 | }, 18 | { 19 | "description": "ignores non-arrays", 20 | "data": {"foo" : "bar"}, 21 | "valid": true 22 | } 23 | ] 24 | }, 25 | { 26 | "description": "an array of schemas for items", 27 | "schema": { 28 | "items": [ 29 | {"type": "integer"}, 30 | {"type": "string"} 31 | ] 32 | }, 33 | "tests": [ 34 | { 35 | "description": "correct types", 36 | "data": [ 1, "foo" ], 37 | "valid": true 38 | }, 39 | { 40 | "description": "wrong types", 41 | "data": [ "foo", 1 ], 42 | "valid": false 43 | } 44 | ] 45 | } 46 | ] 47 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/maxItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxItems validation", 4 | "schema": {"maxItems": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": [1], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1, 2], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": [1, 2, 3], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "foobar", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/maxLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxLength validation", 4 | "schema": {"maxLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": "f", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": "foo", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 10, 24 | "valid": true 25 | }, 26 | { 27 | "description": "two supplementary Unicode code points is long enough", 28 | "data": "\uD83D\uDCA9\uD83D\uDCA9", 29 | "valid": true 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/minItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minItems validation", 4 | "schema": {"minItems": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": [1, 2], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": [], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/minLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minLength validation", 4 | "schema": {"minLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": "foo", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": "f", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 1, 24 | "valid": true 25 | }, 26 | { 27 | "description": "one supplementary Unicode code point is not long enough", 28 | "data": "\uD83D\uDCA9", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/ecmascript-regex.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "ECMA 262 regex dialect recognition", 4 | "schema": { "format": "regex" }, 5 | "tests": [ 6 | { 7 | "description": "[^] is a valid regex", 8 | "data": "[^]", 9 | "valid": true 10 | }, 11 | { 12 | "description": "ECMA 262 has no support for lookbehind", 13 | "data": "(?<=foo)bar", 14 | "valid": false 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/format/color.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of CSS colors", 4 | "schema": {"format": "color"}, 5 | "tests": [ 6 | { 7 | "description": "a valid CSS color name", 8 | "data": "fuchsia", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid six-digit CSS color code", 13 | "data": "#CC8899", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid three-digit CSS color code", 18 | "data": "#C89", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid CSS color code", 23 | "data": "#00332520", 24 | "valid": false 25 | }, 26 | { 27 | "description": "an invalid CSS color name", 28 | "data": "puce", 29 | "valid": false 30 | }, 31 | { 32 | "description": "a CSS color name containing invalid characters", 33 | "data": "light_grayish_red-violet", 34 | "valid": false 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/format/date-time.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of date-time strings", 4 | "schema": {"format": "date-time"}, 5 | "tests": [ 6 | { 7 | "description": "a valid date-time string", 8 | "data": "1963-06-19T08:30:06.283185Z", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid date-time string", 13 | "data": "06/19/1963 08:30:06 PST", 14 | "valid": false 15 | }, 16 | { 17 | "description": "case-insensitive T and Z", 18 | "data": "1963-06-19t08:30:06.283185z", 19 | "valid": true 20 | }, 21 | { 22 | "description": "only RFC3339 not all of ISO 8601 are valid", 23 | "data": "2013-350T01:01:01", 24 | "valid": false 25 | }, 26 | { 27 | "description": "invalid non-padded month dates", 28 | "data": "1963-6-19T08:30:06.283185Z", 29 | "valid": false 30 | }, 31 | { 32 | "description": "invalid non-padded day dates", 33 | "data": "1963-06-1T08:30:06.283185Z", 34 | "valid": false 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/format/date.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of date strings", 4 | "schema": {"format": "date"}, 5 | "tests": [ 6 | { 7 | "description": "a valid date string", 8 | "data": "1963-06-19", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid date string", 13 | "data": "06/19/1963", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "2013-350", 19 | "valid": false 20 | }, 21 | { 22 | "description": "invalidates non-padded month dates", 23 | "data": "1998-1-20", 24 | "valid": false 25 | }, 26 | { 27 | "description": "invalidates non-padded day dates", 28 | "data": "1998-01-1", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/format/email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of e-mail addresses", 4 | "schema": {"format": "email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid e-mail address", 8 | "data": "joe.bloggs@example.com", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "tilde in local part is valid", 18 | "data": "te~st@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "tilde before local part is valid", 23 | "data": "~test@example.com", 24 | "valid": true 25 | }, 26 | { 27 | "description": "tilde after local part is valid", 28 | "data": "test~@example.com", 29 | "valid": true 30 | }, 31 | { 32 | "description": "dot before local part is not valid", 33 | "data": ".test@example.com", 34 | "valid": false 35 | }, 36 | { 37 | "description": "dot after local part is not valid", 38 | "data": "test.@example.com", 39 | "valid": false 40 | }, 41 | { 42 | "description": "two separated dots inside local part are valid", 43 | "data": "te.s.t@example.com", 44 | "valid": true 45 | }, 46 | { 47 | "description": "two subsequent dots inside local part are not valid", 48 | "data": "te..st@example.com", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/format/ip-address.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of IP addresses", 4 | "schema": {"format": "ip-address"}, 5 | "tests": [ 6 | { 7 | "description": "a valid IP address", 8 | "data": "192.168.0.1", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an IP address with too many components", 13 | "data": "127.0.0.0.1", 14 | "valid": false 15 | }, 16 | { 17 | "description": "an IP address with out-of-range values", 18 | "data": "256.256.256.256", 19 | "valid": false 20 | } 21 | ] 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/format/regex.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of regular expressions", 4 | "schema": {"format": "regex"}, 5 | "tests": [ 6 | { 7 | "description": "a valid regular expression", 8 | "data": "([abc])+\\s+$", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a regular expression with unclosed parens is invalid", 13 | "data": "^(abc]", 14 | "valid": false 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/format/time.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of time strings", 4 | "schema": {"format": "time"}, 5 | "tests": [ 6 | { 7 | "description": "a valid time string", 8 | "data": "08:30:06", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid time string", 13 | "data": "8:30 AM", 14 | "valid": false 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/format/uri.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of URIs", 4 | "schema": {"format": "uri"}, 5 | "tests": [ 6 | { 7 | "description": "a valid URI", 8 | "data": "http://foo.bar/?baz=qux#quux", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid protocol-relative URI Reference", 13 | "data": "//foo.bar/?baz=qux#quux", 14 | "valid": false 15 | }, 16 | { 17 | "description": "an invalid URI", 18 | "data": "\\\\WINDOWS\\fileshare", 19 | "valid": false 20 | }, 21 | { 22 | "description": "an invalid URI though valid URI reference", 23 | "data": "abc", 24 | "valid": false 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/optional/zeroTerminatedFloats.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "some languages do not distinguish between different types of numeric value", 4 | "schema": { 5 | "type": "integer" 6 | }, 7 | "tests": [ 8 | { 9 | "description": "a float is not an integer even without fractional part", 10 | "data": 1.0, 11 | "valid": false 12 | } 13 | ] 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/pattern.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "pattern validation", 4 | "schema": {"pattern": "^a*$"}, 5 | "tests": [ 6 | { 7 | "description": "a matching pattern is valid", 8 | "data": "aaa", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a non-matching pattern is invalid", 13 | "data": "abc", 14 | "valid": false 15 | }, 16 | { 17 | "description": "ignores booleans", 18 | "data": true, 19 | "valid": true 20 | }, 21 | { 22 | "description": "ignores integers", 23 | "data": 123, 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores floats", 28 | "data": 1.0, 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores objects", 33 | "data": {}, 34 | "valid": true 35 | }, 36 | { 37 | "description": "ignores arrays", 38 | "data": [], 39 | "valid": true 40 | }, 41 | { 42 | "description": "ignores null", 43 | "data": null, 44 | "valid": true 45 | } 46 | ] 47 | }, 48 | { 49 | "description": "pattern is not anchored", 50 | "schema": {"pattern": "a+"}, 51 | "tests": [ 52 | { 53 | "description": "matches a substring", 54 | "data": "xxaayy", 55 | "valid": true 56 | } 57 | ] 58 | } 59 | ] 60 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft3/required.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "required validation", 4 | "schema": { 5 | "properties": { 6 | "foo": {"required" : true}, 7 | "bar": {} 8 | } 9 | }, 10 | "tests": [ 11 | { 12 | "description": "present required property is valid", 13 | "data": {"foo": 1}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "non-present required property is invalid", 18 | "data": {"bar": 1}, 19 | "valid": false 20 | } 21 | ] 22 | }, 23 | { 24 | "description": "required default validation", 25 | "schema": { 26 | "properties": { 27 | "foo": {} 28 | } 29 | }, 30 | "tests": [ 31 | { 32 | "description": "not required by default", 33 | "data": {}, 34 | "valid": true 35 | } 36 | ] 37 | }, 38 | { 39 | "description": "required explicitly false validation", 40 | "schema": { 41 | "properties": { 42 | "foo": {"required": false} 43 | } 44 | }, 45 | "tests": [ 46 | { 47 | "description": "not required if required is false", 48 | "data": {}, 49 | "valid": true 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/definitions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validate definition against metaschema", 4 | "schema": {"$ref": "http://json-schema.org/draft-04/schema#"}, 5 | "tests": [ 6 | { 7 | "description": "valid definition schema", 8 | "data": { 9 | "definitions": { 10 | "foo": {"type": "integer"} 11 | } 12 | }, 13 | "valid": true 14 | }, 15 | { 16 | "description": "invalid definition schema", 17 | "data": { 18 | "definitions": { 19 | "foo": {"type": 1} 20 | } 21 | }, 22 | "valid": false 23 | } 24 | ] 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/id.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "id inside an enum is not a real identifier", 4 | "comment": "the implementation must not be confused by an id buried in the enum", 5 | "schema": { 6 | "definitions": { 7 | "id_in_enum": { 8 | "enum": [ 9 | { 10 | "id": "https://localhost:1234/my_identifier.json", 11 | "type": "null" 12 | } 13 | ] 14 | }, 15 | "real_id_in_schema": { 16 | "id": "https://localhost:1234/my_identifier.json", 17 | "type": "string" 18 | }, 19 | "zzz_id_in_const": { 20 | "const": { 21 | "id": "https://localhost:1234/my_identifier.json", 22 | "type": "null" 23 | } 24 | } 25 | }, 26 | "anyOf": [ 27 | { "$ref": "#/definitions/id_in_enum" }, 28 | { "$ref": "https://localhost:1234/my_identifier.json" } 29 | ] 30 | }, 31 | "tests": [ 32 | { 33 | "description": "exact match to enum, and type matches", 34 | "data": { 35 | "id": "https://localhost:1234/my_identifier.json", 36 | "type": "null" 37 | }, 38 | "valid": true 39 | }, 40 | { 41 | "description": "match $ref to id", 42 | "data": "a string to match #/definitions/id_in_enum", 43 | "valid": true 44 | }, 45 | { 46 | "description": "no match on enum or $ref to id", 47 | "data": 1, 48 | "valid": false 49 | } 50 | ] 51 | } 52 | 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/infinite-loop-detection.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop", 4 | "schema": { 5 | "definitions": { 6 | "int": { "type": "integer" } 7 | }, 8 | "allOf": [ 9 | { 10 | "properties": { 11 | "foo": { 12 | "$ref": "#/definitions/int" 13 | } 14 | } 15 | }, 16 | { 17 | "additionalProperties": { 18 | "$ref": "#/definitions/int" 19 | } 20 | } 21 | ] 22 | }, 23 | "tests": [ 24 | { 25 | "description": "passing case", 26 | "data": { "foo": 1 }, 27 | "valid": true 28 | }, 29 | { 30 | "description": "failing case", 31 | "data": { "foo": "a string" }, 32 | "valid": false 33 | } 34 | ] 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/maxItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxItems validation", 4 | "schema": {"maxItems": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": [1], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1, 2], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": [1, 2, 3], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "foobar", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/maxLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxLength validation", 4 | "schema": {"maxLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": "f", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": "foo", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 100, 24 | "valid": true 25 | }, 26 | { 27 | "description": "two supplementary Unicode code points is long enough", 28 | "data": "\uD83D\uDCA9\uD83D\uDCA9", 29 | "valid": true 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/maxProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxProperties validation", 4 | "schema": {"maxProperties": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": {"foo": 1}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1, "bar": 2}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": {"foo": 1, "bar": 2, "baz": 3}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [1, 2, 3], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "foobar", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | }, 38 | { 39 | "description": "maxProperties = 0 means the object is empty", 40 | "schema": { "maxProperties": 0 }, 41 | "tests": [ 42 | { 43 | "description": "no properties is valid", 44 | "data": {}, 45 | "valid": true 46 | }, 47 | { 48 | "description": "one property is invalid", 49 | "data": { "foo": 1 }, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/minItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minItems validation", 4 | "schema": {"minItems": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": [1, 2], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": [], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/minLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minLength validation", 4 | "schema": {"minLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": "foo", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": "f", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 1, 24 | "valid": true 25 | }, 26 | { 27 | "description": "one supplementary Unicode code point is not long enough", 28 | "data": "\uD83D\uDCA9", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/minProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minProperties validation", 4 | "schema": {"minProperties": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": {"foo": 1, "bar": 2}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": {}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/optional/float-overflow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "all integers are multiples of 0.5, if overflow is handled", 4 | "schema": {"type": "number", "multipleOf": 0.5}, 5 | "tests": [ 6 | { 7 | "description": "valid if optional overflow handling is implemented", 8 | "data": 1e308, 9 | "valid": true 10 | } 11 | ] 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/optional/format/email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of e-mail addresses", 4 | "schema": {"format": "email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid e-mail address", 8 | "data": "joe.bloggs@example.com", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "tilde in local part is valid", 18 | "data": "te~st@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "tilde before local part is valid", 23 | "data": "~test@example.com", 24 | "valid": true 25 | }, 26 | { 27 | "description": "tilde after local part is valid", 28 | "data": "test~@example.com", 29 | "valid": true 30 | }, 31 | { 32 | "description": "dot before local part is not valid", 33 | "data": ".test@example.com", 34 | "valid": false 35 | }, 36 | { 37 | "description": "dot after local part is not valid", 38 | "data": "test.@example.com", 39 | "valid": false 40 | }, 41 | { 42 | "description": "two separated dots inside local part are valid", 43 | "data": "te.s.t@example.com", 44 | "valid": true 45 | }, 46 | { 47 | "description": "two subsequent dots inside local part are not valid", 48 | "data": "te..st@example.com", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/optional/zeroTerminatedFloats.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "some languages do not distinguish between different types of numeric value", 4 | "schema": { 5 | "type": "integer" 6 | }, 7 | "tests": [ 8 | { 9 | "description": "a float is not an integer even without fractional part", 10 | "data": 1.0, 11 | "valid": false 12 | } 13 | ] 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft4/pattern.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "pattern validation", 4 | "schema": {"pattern": "^a*$"}, 5 | "tests": [ 6 | { 7 | "description": "a matching pattern is valid", 8 | "data": "aaa", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a non-matching pattern is invalid", 13 | "data": "abc", 14 | "valid": false 15 | }, 16 | { 17 | "description": "ignores booleans", 18 | "data": true, 19 | "valid": true 20 | }, 21 | { 22 | "description": "ignores integers", 23 | "data": 123, 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores floats", 28 | "data": 1.0, 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores objects", 33 | "data": {}, 34 | "valid": true 35 | }, 36 | { 37 | "description": "ignores arrays", 38 | "data": [], 39 | "valid": true 40 | }, 41 | { 42 | "description": "ignores null", 43 | "data": null, 44 | "valid": true 45 | } 46 | ] 47 | }, 48 | { 49 | "description": "pattern is not anchored", 50 | "schema": {"pattern": "a+"}, 51 | "tests": [ 52 | { 53 | "description": "matches a substring", 54 | "data": "xxaayy", 55 | "valid": true 56 | } 57 | ] 58 | } 59 | ] 60 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/definitions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validate definition against metaschema", 4 | "schema": {"$ref": "http://json-schema.org/draft-06/schema#"}, 5 | "tests": [ 6 | { 7 | "description": "valid definition schema", 8 | "data": { 9 | "definitions": { 10 | "foo": {"type": "integer"} 11 | } 12 | }, 13 | "valid": true 14 | }, 15 | { 16 | "description": "invalid definition schema", 17 | "data": { 18 | "definitions": { 19 | "foo": {"type": 1} 20 | } 21 | }, 22 | "valid": false 23 | } 24 | ] 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/exclusiveMaximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMaximum validation", 4 | "schema": { 5 | "exclusiveMaximum": 3.0 6 | }, 7 | "tests": [ 8 | { 9 | "description": "below the exclusiveMaximum is valid", 10 | "data": 2.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 3.0, 16 | "valid": false 17 | }, 18 | { 19 | "description": "above the exclusiveMaximum is invalid", 20 | "data": 3.5, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/exclusiveMinimum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMinimum validation", 4 | "schema": { 5 | "exclusiveMinimum": 1.1 6 | }, 7 | "tests": [ 8 | { 9 | "description": "above the exclusiveMinimum is valid", 10 | "data": 1.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 1.1, 16 | "valid": false 17 | }, 18 | { 19 | "description": "below the exclusiveMinimum is invalid", 20 | "data": 0.6, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/infinite-loop-detection.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop", 4 | "schema": { 5 | "definitions": { 6 | "int": { "type": "integer" } 7 | }, 8 | "allOf": [ 9 | { 10 | "properties": { 11 | "foo": { 12 | "$ref": "#/definitions/int" 13 | } 14 | } 15 | }, 16 | { 17 | "additionalProperties": { 18 | "$ref": "#/definitions/int" 19 | } 20 | } 21 | ] 22 | }, 23 | "tests": [ 24 | { 25 | "description": "passing case", 26 | "data": { "foo": 1 }, 27 | "valid": true 28 | }, 29 | { 30 | "description": "failing case", 31 | "data": { "foo": "a string" }, 32 | "valid": false 33 | } 34 | ] 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/maxItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxItems validation", 4 | "schema": {"maxItems": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": [1], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1, 2], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": [1, 2, 3], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "foobar", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/maxLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxLength validation", 4 | "schema": {"maxLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": "f", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": "foo", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 100, 24 | "valid": true 25 | }, 26 | { 27 | "description": "two supplementary Unicode code points is long enough", 28 | "data": "\uD83D\uDCA9\uD83D\uDCA9", 29 | "valid": true 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/maxProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxProperties validation", 4 | "schema": {"maxProperties": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": {"foo": 1}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1, "bar": 2}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": {"foo": 1, "bar": 2, "baz": 3}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [1, 2, 3], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "foobar", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | }, 38 | { 39 | "description": "maxProperties = 0 means the object is empty", 40 | "schema": { "maxProperties": 0 }, 41 | "tests": [ 42 | { 43 | "description": "no properties is valid", 44 | "data": {}, 45 | "valid": true 46 | }, 47 | { 48 | "description": "one property is invalid", 49 | "data": { "foo": 1 }, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/maximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maximum validation", 4 | "schema": {"maximum": 3.0}, 5 | "tests": [ 6 | { 7 | "description": "below the maximum is valid", 8 | "data": 2.6, 9 | "valid": true 10 | }, 11 | { 12 | "description": "boundary point is valid", 13 | "data": 3.0, 14 | "valid": true 15 | }, 16 | { 17 | "description": "above the maximum is invalid", 18 | "data": 3.5, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-numbers", 23 | "data": "x", 24 | "valid": true 25 | } 26 | ] 27 | }, 28 | { 29 | "description": "maximum validation with unsigned integer", 30 | "schema": {"maximum": 300}, 31 | "tests": [ 32 | { 33 | "description": "below the maximum is invalid", 34 | "data": 299.97, 35 | "valid": true 36 | }, 37 | { 38 | "description": "boundary point integer is valid", 39 | "data": 300, 40 | "valid": true 41 | }, 42 | { 43 | "description": "boundary point float is valid", 44 | "data": 300.00, 45 | "valid": true 46 | }, 47 | { 48 | "description": "above the maximum is invalid", 49 | "data": 300.5, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/minItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minItems validation", 4 | "schema": {"minItems": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": [1, 2], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": [], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/minLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minLength validation", 4 | "schema": {"minLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": "foo", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": "f", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 1, 24 | "valid": true 25 | }, 26 | { 27 | "description": "one supplementary Unicode code point is not long enough", 28 | "data": "\uD83D\uDCA9", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/minProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minProperties validation", 4 | "schema": {"minProperties": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": {"foo": 1, "bar": 2}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": {}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/optional/float-overflow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "all integers are multiples of 0.5, if overflow is handled", 4 | "schema": {"type": "integer", "multipleOf": 0.5}, 5 | "tests": [ 6 | { 7 | "description": "valid if optional overflow handling is implemented", 8 | "data": 1e308, 9 | "valid": true 10 | } 11 | ] 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/optional/format/email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of e-mail addresses", 4 | "schema": {"format": "email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid e-mail address", 8 | "data": "joe.bloggs@example.com", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "tilde in local part is valid", 18 | "data": "te~st@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "tilde before local part is valid", 23 | "data": "~test@example.com", 24 | "valid": true 25 | }, 26 | { 27 | "description": "tilde after local part is valid", 28 | "data": "test~@example.com", 29 | "valid": true 30 | }, 31 | { 32 | "description": "dot before local part is not valid", 33 | "data": ".test@example.com", 34 | "valid": false 35 | }, 36 | { 37 | "description": "dot after local part is not valid", 38 | "data": "test.@example.com", 39 | "valid": false 40 | }, 41 | { 42 | "description": "two separated dots inside local part are valid", 43 | "data": "te.s.t@example.com", 44 | "valid": true 45 | }, 46 | { 47 | "description": "two subsequent dots inside local part are not valid", 48 | "data": "te..st@example.com", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/optional/format/uri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of URI References", 4 | "schema": {"format": "uri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid URI", 8 | "data": "http://foo.bar/?baz=qux#quux", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative URI Reference", 13 | "data": "//foo.bar/?baz=qux#quux", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative URI Reference", 18 | "data": "/abc", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid URI Reference", 23 | "data": "\\\\WINDOWS\\fileshare", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid URI Reference", 28 | "data": "abc", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid URI fragment", 33 | "data": "#fragment", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid URI fragment", 38 | "data": "#frag\\ment", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/optional/format/uri-template.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "format: uri-template", 4 | "schema": {"format": "uri-template"}, 5 | "tests": [ 6 | { 7 | "description": "a valid uri-template", 8 | "data": "http://example.com/dictionary/{term:1}/{term}", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid uri-template", 13 | "data": "http://example.com/dictionary/{term:1}/{term", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid uri-template without variables", 18 | "data": "http://example.com/dictionary", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid relative uri-template", 23 | "data": "dictionary/{term:1}/{term}", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft6/pattern.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "pattern validation", 4 | "schema": {"pattern": "^a*$"}, 5 | "tests": [ 6 | { 7 | "description": "a matching pattern is valid", 8 | "data": "aaa", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a non-matching pattern is invalid", 13 | "data": "abc", 14 | "valid": false 15 | }, 16 | { 17 | "description": "ignores booleans", 18 | "data": true, 19 | "valid": true 20 | }, 21 | { 22 | "description": "ignores integers", 23 | "data": 123, 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores floats", 28 | "data": 1.0, 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores objects", 33 | "data": {}, 34 | "valid": true 35 | }, 36 | { 37 | "description": "ignores arrays", 38 | "data": [], 39 | "valid": true 40 | }, 41 | { 42 | "description": "ignores null", 43 | "data": null, 44 | "valid": true 45 | } 46 | ] 47 | }, 48 | { 49 | "description": "pattern is not anchored", 50 | "schema": {"pattern": "a+"}, 51 | "tests": [ 52 | { 53 | "description": "matches a substring", 54 | "data": "xxaayy", 55 | "valid": true 56 | } 57 | ] 58 | } 59 | ] 60 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/definitions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validate definition against metaschema", 4 | "schema": {"$ref": "http://json-schema.org/draft-07/schema#"}, 5 | "tests": [ 6 | { 7 | "description": "valid definition schema", 8 | "data": { 9 | "definitions": { 10 | "foo": {"type": "integer"} 11 | } 12 | }, 13 | "valid": true 14 | }, 15 | { 16 | "description": "invalid definition schema", 17 | "data": { 18 | "definitions": { 19 | "foo": {"type": 1} 20 | } 21 | }, 22 | "valid": false 23 | } 24 | ] 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/exclusiveMaximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMaximum validation", 4 | "schema": { 5 | "exclusiveMaximum": 3.0 6 | }, 7 | "tests": [ 8 | { 9 | "description": "below the exclusiveMaximum is valid", 10 | "data": 2.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 3.0, 16 | "valid": false 17 | }, 18 | { 19 | "description": "above the exclusiveMaximum is invalid", 20 | "data": 3.5, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/exclusiveMinimum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMinimum validation", 4 | "schema": { 5 | "exclusiveMinimum": 1.1 6 | }, 7 | "tests": [ 8 | { 9 | "description": "above the exclusiveMinimum is valid", 10 | "data": 1.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 1.1, 16 | "valid": false 17 | }, 18 | { 19 | "description": "below the exclusiveMinimum is invalid", 20 | "data": 0.6, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/infinite-loop-detection.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop", 4 | "schema": { 5 | "definitions": { 6 | "int": { "type": "integer" } 7 | }, 8 | "allOf": [ 9 | { 10 | "properties": { 11 | "foo": { 12 | "$ref": "#/definitions/int" 13 | } 14 | } 15 | }, 16 | { 17 | "additionalProperties": { 18 | "$ref": "#/definitions/int" 19 | } 20 | } 21 | ] 22 | }, 23 | "tests": [ 24 | { 25 | "description": "passing case", 26 | "data": { "foo": 1 }, 27 | "valid": true 28 | }, 29 | { 30 | "description": "failing case", 31 | "data": { "foo": "a string" }, 32 | "valid": false 33 | } 34 | ] 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/maxItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxItems validation", 4 | "schema": {"maxItems": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": [1], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1, 2], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": [1, 2, 3], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "foobar", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/maxLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxLength validation", 4 | "schema": {"maxLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": "f", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": "foo", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 100, 24 | "valid": true 25 | }, 26 | { 27 | "description": "two supplementary Unicode code points is long enough", 28 | "data": "\uD83D\uDCA9\uD83D\uDCA9", 29 | "valid": true 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/maxProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxProperties validation", 4 | "schema": {"maxProperties": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": {"foo": 1}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1, "bar": 2}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": {"foo": 1, "bar": 2, "baz": 3}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [1, 2, 3], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "foobar", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | }, 38 | { 39 | "description": "maxProperties = 0 means the object is empty", 40 | "schema": { "maxProperties": 0 }, 41 | "tests": [ 42 | { 43 | "description": "no properties is valid", 44 | "data": {}, 45 | "valid": true 46 | }, 47 | { 48 | "description": "one property is invalid", 49 | "data": { "foo": 1 }, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/maximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maximum validation", 4 | "schema": {"maximum": 3.0}, 5 | "tests": [ 6 | { 7 | "description": "below the maximum is valid", 8 | "data": 2.6, 9 | "valid": true 10 | }, 11 | { 12 | "description": "boundary point is valid", 13 | "data": 3.0, 14 | "valid": true 15 | }, 16 | { 17 | "description": "above the maximum is invalid", 18 | "data": 3.5, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-numbers", 23 | "data": "x", 24 | "valid": true 25 | } 26 | ] 27 | }, 28 | { 29 | "description": "maximum validation with unsigned integer", 30 | "schema": {"maximum": 300}, 31 | "tests": [ 32 | { 33 | "description": "below the maximum is invalid", 34 | "data": 299.97, 35 | "valid": true 36 | }, 37 | { 38 | "description": "boundary point integer is valid", 39 | "data": 300, 40 | "valid": true 41 | }, 42 | { 43 | "description": "boundary point float is valid", 44 | "data": 300.00, 45 | "valid": true 46 | }, 47 | { 48 | "description": "above the maximum is invalid", 49 | "data": 300.5, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/minItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minItems validation", 4 | "schema": {"minItems": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": [1, 2], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": [], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/minLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minLength validation", 4 | "schema": {"minLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": "foo", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": "f", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 1, 24 | "valid": true 25 | }, 26 | { 27 | "description": "one supplementary Unicode code point is not long enough", 28 | "data": "\uD83D\uDCA9", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/minProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minProperties validation", 4 | "schema": {"minProperties": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": {"foo": 1, "bar": 2}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": {}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/float-overflow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "all integers are multiples of 0.5, if overflow is handled", 4 | "schema": {"type": "integer", "multipleOf": 0.5}, 5 | "tests": [ 6 | { 7 | "description": "valid if optional overflow handling is implemented", 8 | "data": 1e308, 9 | "valid": true 10 | } 11 | ] 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/date.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of date strings", 4 | "schema": {"format": "date"}, 5 | "tests": [ 6 | { 7 | "description": "a valid date string", 8 | "data": "1963-06-19", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid date-time string", 13 | "data": "06/19/1963", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "2013-350", 19 | "valid": false 20 | }, 21 | { 22 | "description": "invalidates non-padded month dates", 23 | "data": "1998-1-20", 24 | "valid": false 25 | }, 26 | { 27 | "description": "invalidates non-padded day dates", 28 | "data": "1998-01-1", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of e-mail addresses", 4 | "schema": {"format": "email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid e-mail address", 8 | "data": "joe.bloggs@example.com", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "tilde in local part is valid", 18 | "data": "te~st@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "tilde before local part is valid", 23 | "data": "~test@example.com", 24 | "valid": true 25 | }, 26 | { 27 | "description": "tilde after local part is valid", 28 | "data": "test~@example.com", 29 | "valid": true 30 | }, 31 | { 32 | "description": "dot before local part is not valid", 33 | "data": ".test@example.com", 34 | "valid": false 35 | }, 36 | { 37 | "description": "dot after local part is not valid", 38 | "data": "test.@example.com", 39 | "valid": false 40 | }, 41 | { 42 | "description": "two separated dots inside local part are valid", 43 | "data": "te.s.t@example.com", 44 | "valid": true 45 | }, 46 | { 47 | "description": "two subsequent dots inside local part are not valid", 48 | "data": "te..st@example.com", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/idn-email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of an internationalized e-mail addresses", 4 | "schema": {"format": "idn-email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid idn e-mail (example@example.test in Hangul)", 8 | "data": "실례@실례.테스트", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid idn e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid e-mail address", 18 | "data": "joe.bloggs@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid e-mail address", 23 | "data": "2962", 24 | "valid": false 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/iri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of IRI References", 4 | "schema": {"format": "iri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid IRI", 8 | "data": "http://ƒøø.ßår/?∂éœ=πîx#πîüx", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative IRI Reference", 13 | "data": "//ƒøø.ßår/?∂éœ=πîx#πîüx", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative IRI Reference", 18 | "data": "/âππ", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid IRI Reference", 23 | "data": "\\\\WINDOWS\\filëßåré", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid IRI Reference", 28 | "data": "âππ", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid IRI fragment", 33 | "data": "#ƒrägmênt", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid IRI fragment", 38 | "data": "#ƒräg\\mênt", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/regex.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of regular expressions", 4 | "schema": {"format": "regex"}, 5 | "tests": [ 6 | { 7 | "description": "a valid regular expression", 8 | "data": "([abc])+\\s+$", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a regular expression with unclosed parens is invalid", 13 | "data": "^(abc]", 14 | "valid": false 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/relative-json-pointer.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of Relative JSON Pointers (RJP)", 4 | "schema": {"format": "relative-json-pointer"}, 5 | "tests": [ 6 | { 7 | "description": "a valid upwards RJP", 8 | "data": "1", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid downwards RJP", 13 | "data": "0/foo/bar", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid up and then down RJP, with array index", 18 | "data": "2/0/baz/1/zip", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid RJP taking the member or index name", 23 | "data": "0#", 24 | "valid": true 25 | }, 26 | { 27 | "description": "an invalid RJP that is a valid JSON Pointer", 28 | "data": "/foo/bar", 29 | "valid": false 30 | }, 31 | { 32 | "description": "negative prefix", 33 | "data": "-1/foo/bar", 34 | "valid": false 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/time.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of time strings", 4 | "schema": {"format": "time"}, 5 | "tests": [ 6 | { 7 | "description": "a valid time string", 8 | "data": "08:30:06.283185Z", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid time string", 13 | "data": "08:30:06 PST", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "01:01:01,1111", 19 | "valid": false 20 | } 21 | ] 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/uri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of URI References", 4 | "schema": {"format": "uri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid URI", 8 | "data": "http://foo.bar/?baz=qux#quux", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative URI Reference", 13 | "data": "//foo.bar/?baz=qux#quux", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative URI Reference", 18 | "data": "/abc", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid URI Reference", 23 | "data": "\\\\WINDOWS\\fileshare", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid URI Reference", 28 | "data": "abc", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid URI fragment", 33 | "data": "#fragment", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid URI fragment", 38 | "data": "#frag\\ment", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/optional/format/uri-template.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "format: uri-template", 4 | "schema": {"format": "uri-template"}, 5 | "tests": [ 6 | { 7 | "description": "a valid uri-template", 8 | "data": "http://example.com/dictionary/{term:1}/{term}", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid uri-template", 13 | "data": "http://example.com/dictionary/{term:1}/{term", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid uri-template without variables", 18 | "data": "http://example.com/dictionary", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid relative uri-template", 23 | "data": "dictionary/{term:1}/{term}", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/draft7/pattern.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "pattern validation", 4 | "schema": {"pattern": "^a*$"}, 5 | "tests": [ 6 | { 7 | "description": "a matching pattern is valid", 8 | "data": "aaa", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a non-matching pattern is invalid", 13 | "data": "abc", 14 | "valid": false 15 | }, 16 | { 17 | "description": "ignores booleans", 18 | "data": true, 19 | "valid": true 20 | }, 21 | { 22 | "description": "ignores integers", 23 | "data": 123, 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores floats", 28 | "data": 1.0, 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores objects", 33 | "data": {}, 34 | "valid": true 35 | }, 36 | { 37 | "description": "ignores arrays", 38 | "data": [], 39 | "valid": true 40 | }, 41 | { 42 | "description": "ignores null", 43 | "data": null, 44 | "valid": true 45 | } 46 | ] 47 | }, 48 | { 49 | "description": "pattern is not anchored", 50 | "schema": {"pattern": "a+"}, 51 | "tests": [ 52 | { 53 | "description": "matches a substring", 54 | "data": "xxaayy", 55 | "valid": true 56 | } 57 | ] 58 | } 59 | ] 60 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/defs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validate definition against metaschema", 4 | "schema": { 5 | "$ref": "https://json-schema.org/draft/2020-12/schema" 6 | }, 7 | "tests": [ 8 | { 9 | "description": "valid definition schema", 10 | "data": {"$defs": {"foo": {"type": "integer"}}}, 11 | "valid": true 12 | }, 13 | { 14 | "description": "invalid definition schema", 15 | "data": {"$defs": {"foo": {"type": 1}}}, 16 | "valid": false 17 | } 18 | ] 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/exclusiveMaximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMaximum validation", 4 | "schema": { 5 | "exclusiveMaximum": 3.0 6 | }, 7 | "tests": [ 8 | { 9 | "description": "below the exclusiveMaximum is valid", 10 | "data": 2.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 3.0, 16 | "valid": false 17 | }, 18 | { 19 | "description": "above the exclusiveMaximum is invalid", 20 | "data": 3.5, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/exclusiveMinimum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "exclusiveMinimum validation", 4 | "schema": { 5 | "exclusiveMinimum": 1.1 6 | }, 7 | "tests": [ 8 | { 9 | "description": "above the exclusiveMinimum is valid", 10 | "data": 1.2, 11 | "valid": true 12 | }, 13 | { 14 | "description": "boundary point is invalid", 15 | "data": 1.1, 16 | "valid": false 17 | }, 18 | { 19 | "description": "below the exclusiveMinimum is invalid", 20 | "data": 0.6, 21 | "valid": false 22 | }, 23 | { 24 | "description": "ignores non-numbers", 25 | "data": "x", 26 | "valid": true 27 | } 28 | ] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/infinite-loop-detection.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop", 4 | "schema": { 5 | "$defs": { 6 | "int": { "type": "integer" } 7 | }, 8 | "allOf": [ 9 | { 10 | "properties": { 11 | "foo": { 12 | "$ref": "#/$defs/int" 13 | } 14 | } 15 | }, 16 | { 17 | "additionalProperties": { 18 | "$ref": "#/$defs/int" 19 | } 20 | } 21 | ] 22 | }, 23 | "tests": [ 24 | { 25 | "description": "passing case", 26 | "data": { "foo": 1 }, 27 | "valid": true 28 | }, 29 | { 30 | "description": "failing case", 31 | "data": { "foo": "a string" }, 32 | "valid": false 33 | } 34 | ] 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/maxItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxItems validation", 4 | "schema": {"maxItems": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": [1], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1, 2], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": [1, 2, 3], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "foobar", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/maxLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxLength validation", 4 | "schema": {"maxLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": "f", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": "foo", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 100, 24 | "valid": true 25 | }, 26 | { 27 | "description": "two supplementary Unicode code points is long enough", 28 | "data": "\uD83D\uDCA9\uD83D\uDCA9", 29 | "valid": true 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/maxProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maxProperties validation", 4 | "schema": {"maxProperties": 2}, 5 | "tests": [ 6 | { 7 | "description": "shorter is valid", 8 | "data": {"foo": 1}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1, "bar": 2}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too long is invalid", 18 | "data": {"foo": 1, "bar": 2, "baz": 3}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [1, 2, 3], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "foobar", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | }, 38 | { 39 | "description": "maxProperties = 0 means the object is empty", 40 | "schema": { "maxProperties": 0 }, 41 | "tests": [ 42 | { 43 | "description": "no properties is valid", 44 | "data": {}, 45 | "valid": true 46 | }, 47 | { 48 | "description": "one property is invalid", 49 | "data": { "foo": 1 }, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/maximum.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "maximum validation", 4 | "schema": {"maximum": 3.0}, 5 | "tests": [ 6 | { 7 | "description": "below the maximum is valid", 8 | "data": 2.6, 9 | "valid": true 10 | }, 11 | { 12 | "description": "boundary point is valid", 13 | "data": 3.0, 14 | "valid": true 15 | }, 16 | { 17 | "description": "above the maximum is invalid", 18 | "data": 3.5, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-numbers", 23 | "data": "x", 24 | "valid": true 25 | } 26 | ] 27 | }, 28 | { 29 | "description": "maximum validation with unsigned integer", 30 | "schema": {"maximum": 300}, 31 | "tests": [ 32 | { 33 | "description": "below the maximum is invalid", 34 | "data": 299.97, 35 | "valid": true 36 | }, 37 | { 38 | "description": "boundary point integer is valid", 39 | "data": 300, 40 | "valid": true 41 | }, 42 | { 43 | "description": "boundary point float is valid", 44 | "data": 300.00, 45 | "valid": true 46 | }, 47 | { 48 | "description": "above the maximum is invalid", 49 | "data": 300.5, 50 | "valid": false 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/minItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minItems validation", 4 | "schema": {"minItems": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": [1, 2], 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": [1], 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": [], 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-arrays", 23 | "data": "", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/minLength.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minLength validation", 4 | "schema": {"minLength": 2}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": "foo", 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": "fo", 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": "f", 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores non-strings", 23 | "data": 1, 24 | "valid": true 25 | }, 26 | { 27 | "description": "one supplementary Unicode code point is not long enough", 28 | "data": "\uD83D\uDCA9", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/minProperties.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "minProperties validation", 4 | "schema": {"minProperties": 1}, 5 | "tests": [ 6 | { 7 | "description": "longer is valid", 8 | "data": {"foo": 1, "bar": 2}, 9 | "valid": true 10 | }, 11 | { 12 | "description": "exact length is valid", 13 | "data": {"foo": 1}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "too short is invalid", 18 | "data": {}, 19 | "valid": false 20 | }, 21 | { 22 | "description": "ignores arrays", 23 | "data": [], 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores strings", 28 | "data": "", 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores other non-objects", 33 | "data": 12, 34 | "valid": true 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/float-overflow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "all integers are multiples of 0.5, if overflow is handled", 4 | "schema": {"type": "integer", "multipleOf": 0.5}, 5 | "tests": [ 6 | { 7 | "description": "valid if optional overflow handling is implemented", 8 | "data": 1e308, 9 | "valid": true 10 | } 11 | ] 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/date.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of date strings", 4 | "schema": {"format": "date"}, 5 | "tests": [ 6 | { 7 | "description": "a valid date string", 8 | "data": "1963-06-19", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid date-time string", 13 | "data": "06/19/1963", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "2013-350", 19 | "valid": false 20 | }, 21 | { 22 | "description": "invalidates non-padded month dates", 23 | "data": "1998-1-20", 24 | "valid": false 25 | }, 26 | { 27 | "description": "invalidates non-padded day dates", 28 | "data": "1998-01-1", 29 | "valid": false 30 | } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of e-mail addresses", 4 | "schema": {"format": "email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid e-mail address", 8 | "data": "joe.bloggs@example.com", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "tilde in local part is valid", 18 | "data": "te~st@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "tilde before local part is valid", 23 | "data": "~test@example.com", 24 | "valid": true 25 | }, 26 | { 27 | "description": "tilde after local part is valid", 28 | "data": "test~@example.com", 29 | "valid": true 30 | }, 31 | { 32 | "description": "dot before local part is not valid", 33 | "data": ".test@example.com", 34 | "valid": false 35 | }, 36 | { 37 | "description": "dot after local part is not valid", 38 | "data": "test.@example.com", 39 | "valid": false 40 | }, 41 | { 42 | "description": "two separated dots inside local part are valid", 43 | "data": "te.s.t@example.com", 44 | "valid": true 45 | }, 46 | { 47 | "description": "two subsequent dots inside local part are not valid", 48 | "data": "te..st@example.com", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/idn-email.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of an internationalized e-mail addresses", 4 | "schema": {"format": "idn-email"}, 5 | "tests": [ 6 | { 7 | "description": "a valid idn e-mail (example@example.test in Hangul)", 8 | "data": "실례@실례.테스트", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid idn e-mail address", 13 | "data": "2962", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid e-mail address", 18 | "data": "joe.bloggs@example.com", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid e-mail address", 23 | "data": "2962", 24 | "valid": false 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/iri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of IRI References", 4 | "schema": {"format": "iri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid IRI", 8 | "data": "http://ƒøø.ßår/?∂éœ=πîx#πîüx", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative IRI Reference", 13 | "data": "//ƒøø.ßår/?∂éœ=πîx#πîüx", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative IRI Reference", 18 | "data": "/âππ", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid IRI Reference", 23 | "data": "\\\\WINDOWS\\filëßåré", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid IRI Reference", 28 | "data": "âππ", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid IRI fragment", 33 | "data": "#ƒrägmênt", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid IRI fragment", 38 | "data": "#ƒräg\\mênt", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/regex.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of regular expressions", 4 | "schema": {"format": "regex"}, 5 | "tests": [ 6 | { 7 | "description": "a valid regular expression", 8 | "data": "([abc])+\\s+$", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a regular expression with unclosed parens is invalid", 13 | "data": "^(abc]", 14 | "valid": false 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/relative-json-pointer.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of Relative JSON Pointers (RJP)", 4 | "schema": {"format": "relative-json-pointer"}, 5 | "tests": [ 6 | { 7 | "description": "a valid upwards RJP", 8 | "data": "1", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid downwards RJP", 13 | "data": "0/foo/bar", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid up and then down RJP, with array index", 18 | "data": "2/0/baz/1/zip", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid RJP taking the member or index name", 23 | "data": "0#", 24 | "valid": true 25 | }, 26 | { 27 | "description": "an invalid RJP that is a valid JSON Pointer", 28 | "data": "/foo/bar", 29 | "valid": false 30 | }, 31 | { 32 | "description": "negative prefix", 33 | "data": "-1/foo/bar", 34 | "valid": false 35 | }, 36 | { 37 | "description": "## is not a valid json-pointer", 38 | "data": "0##", 39 | "valid": false 40 | }, 41 | { 42 | "description": "zero cannot be followed by other digits, plus json-pointer", 43 | "data": "01/a", 44 | "valid": false 45 | }, 46 | { 47 | "description": "zero cannot be followed by other digits, plus octothorpe", 48 | "data": "01#", 49 | "valid": false 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/time.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of time strings", 4 | "schema": {"format": "time"}, 5 | "tests": [ 6 | { 7 | "description": "a valid time string", 8 | "data": "08:30:06.283185Z", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid time string", 13 | "data": "08:30:06 PST", 14 | "valid": false 15 | }, 16 | { 17 | "description": "only RFC3339 not all of ISO 8601 are valid", 18 | "data": "01:01:01,1111", 19 | "valid": false 20 | } 21 | ] 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/uri-reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "validation of URI References", 4 | "schema": {"format": "uri-reference"}, 5 | "tests": [ 6 | { 7 | "description": "a valid URI", 8 | "data": "http://foo.bar/?baz=qux#quux", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a valid protocol-relative URI Reference", 13 | "data": "//foo.bar/?baz=qux#quux", 14 | "valid": true 15 | }, 16 | { 17 | "description": "a valid relative URI Reference", 18 | "data": "/abc", 19 | "valid": true 20 | }, 21 | { 22 | "description": "an invalid URI Reference", 23 | "data": "\\\\WINDOWS\\fileshare", 24 | "valid": false 25 | }, 26 | { 27 | "description": "a valid URI Reference", 28 | "data": "abc", 29 | "valid": true 30 | }, 31 | { 32 | "description": "a valid URI fragment", 33 | "data": "#fragment", 34 | "valid": true 35 | }, 36 | { 37 | "description": "an invalid URI fragment", 38 | "data": "#frag\\ment", 39 | "valid": false 40 | } 41 | ] 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/format/uri-template.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "format: uri-template", 4 | "schema": {"format": "uri-template"}, 5 | "tests": [ 6 | { 7 | "description": "a valid uri-template", 8 | "data": "http://example.com/dictionary/{term:1}/{term}", 9 | "valid": true 10 | }, 11 | { 12 | "description": "an invalid uri-template", 13 | "data": "http://example.com/dictionary/{term:1}/{term", 14 | "valid": false 15 | }, 16 | { 17 | "description": "a valid uri-template without variables", 18 | "data": "http://example.com/dictionary", 19 | "valid": true 20 | }, 21 | { 22 | "description": "a valid relative uri-template", 23 | "data": "dictionary/{term:1}/{term}", 24 | "valid": true 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/optional/refOfUnknownKeyword.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "reference of a root arbitrary keyword ", 4 | "schema": { 5 | "unknown-keyword": {"type": "integer"}, 6 | "properties": { 7 | "bar": {"$ref": "#/unknown-keyword"} 8 | } 9 | }, 10 | "tests": [ 11 | { 12 | "description": "match", 13 | "data": {"bar": 3}, 14 | "valid": true 15 | }, 16 | { 17 | "description": "mismatch", 18 | "data": {"bar": true}, 19 | "valid": false 20 | } 21 | ] 22 | }, 23 | { 24 | "description": "reference of an arbitrary keyword of a sub-schema", 25 | "schema": { 26 | "properties": { 27 | "foo": {"unknown-keyword": {"type": "integer"}}, 28 | "bar": {"$ref": "#/properties/foo/unknown-keyword"} 29 | } 30 | }, 31 | "tests": [ 32 | { 33 | "description": "match", 34 | "data": {"bar": 3}, 35 | "valid": true 36 | }, 37 | { 38 | "description": "mismatch", 39 | "data": {"bar": true}, 40 | "valid": false 41 | } 42 | ] 43 | } 44 | ] 45 | -------------------------------------------------------------------------------- /src/test/resources/test-suite/tests/latest/pattern.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "description": "pattern validation", 4 | "schema": {"pattern": "^a*$"}, 5 | "tests": [ 6 | { 7 | "description": "a matching pattern is valid", 8 | "data": "aaa", 9 | "valid": true 10 | }, 11 | { 12 | "description": "a non-matching pattern is invalid", 13 | "data": "abc", 14 | "valid": false 15 | }, 16 | { 17 | "description": "ignores booleans", 18 | "data": true, 19 | "valid": true 20 | }, 21 | { 22 | "description": "ignores integers", 23 | "data": 123, 24 | "valid": true 25 | }, 26 | { 27 | "description": "ignores floats", 28 | "data": 1.0, 29 | "valid": true 30 | }, 31 | { 32 | "description": "ignores objects", 33 | "data": {}, 34 | "valid": true 35 | }, 36 | { 37 | "description": "ignores arrays", 38 | "data": [], 39 | "valid": true 40 | }, 41 | { 42 | "description": "ignores null", 43 | "data": null, 44 | "valid": true 45 | } 46 | ] 47 | }, 48 | { 49 | "description": "pattern is not anchored", 50 | "schema": {"pattern": "a+"}, 51 | "tests": [ 52 | { 53 | "description": "matches a substring", 54 | "data": "xxaayy", 55 | "valid": true 56 | } 57 | ] 58 | } 59 | ] 60 | -------------------------------------------------------------------------------- /src/test/resources/test-type-null.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "http://pwall.net/schema/test/type-null", 3 | "type": "null" 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/test-unique-item.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test-unique-item", 4 | "type": "object", 5 | "properties": { 6 | "aaa": { 7 | "type": "array", 8 | "items": { 9 | "type": "integer" 10 | }, 11 | "uniqueItems": true 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/test1/person/person.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test/schema/person", 4 | "title": "Person", 5 | "description": "A class to represent a person", 6 | "type": "object", 7 | "required": ["id", "name"], 8 | "properties": { 9 | "id": { 10 | "$ref": "http://pwall.net/test/schema/utility#/$defs/personId", 11 | "description": "Id of the person" 12 | }, 13 | "name": { 14 | "type": "string", 15 | "description": "Name of the person" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/test1/utility.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft/2019-09/schema", 3 | "$id": "http://pwall.net/test/schema/utility", 4 | "$defs": { 5 | "personId": { 6 | "type": "string", 7 | "format": "uuid" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/true.schema.json: -------------------------------------------------------------------------------- 1 | true 2 | --------------------------------------------------------------------------------