Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
for k in totals: totals[k]+=int(r.get(k,'0'))
except Exception:
pass
exp_tests=3667
exp_skipped=1425
exp_tests=4426
exp_skipped=1715
if totals['tests']!=exp_tests or totals['skipped']!=exp_skipped:
print(f"Unexpected test totals: {totals} != expected tests={exp_tests}, skipped={exp_skipped}")
sys.exit(1)
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
json-java21-schema/src/test/resources/draft4/
json-java21-schema/src/test/resources/json-schema-test-suite-data/

.env
repomix-output*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package io.github.simbo1905.json.schema;

import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;
import java.util.stream.Stream;

/// Runs the official JSON-Schema-Test-Suite (Draft 2020-12) as JUnit dynamic tests.
/// By default, this is lenient and will SKIP mismatches and unsupported schemas
/// to provide a compatibility signal without breaking the build. Enable strict
/// mode with -Djson.schema.strict=true to make mismatches fail the build.
public class JsonSchemaCheck202012IT extends JsonSchemaCheckBaseIT {

private static final Path ZIP_FILE = Paths.get("src/test/resources/json-schema-test-suite-data.zip");
private static final Path TARGET_SUITE_DIR = Paths.get("target/test-data/draft2020-12");

@Override
protected Path getZipFile() {
return ZIP_FILE;
}

@Override
protected Path getTargetSuiteDir() {
return TARGET_SUITE_DIR;
}

@Override
protected String getSchemaPrefix() {
return "draft2020-12/";
}

@Override
protected Set<String> getSkippedTests() {
return Set.of(
// Reference resolution issues - Unresolved $ref problems
"ref.json#relative pointer ref to array#match array",
"ref.json#relative pointer ref to array#mismatch array",
"refOfUnknownKeyword.json#reference of a root arbitrary keyword #match",
"refOfUnknownKeyword.json#reference of a root arbitrary keyword #mismatch",
"refOfUnknownKeyword.json#reference of an arbitrary keyword of a sub-schema#match",
"refOfUnknownKeyword.json#reference of an arbitrary keyword of a sub-schema#mismatch",

// JSON parsing issues with duplicate member names
"required.json#required with escaped characters#object with all properties present is valid",
"required.json#required with escaped characters#object with some properties missing is invalid"
);
}

@TestFactory
@Override
public Stream<DynamicTest> runOfficialSuite() throws Exception {
return super.runOfficialSuite();
}
}
Loading