Skip to content

Commit fafb2d8

Browse files
committed
wip
1 parent 363fee2 commit fafb2d8

File tree

7 files changed

+348
-37
lines changed

7 files changed

+348
-37
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
json-java21-schema/src/test/resources/draft4/
2+
json-java21-schema/src/test/resources/json-schema-test-suite-data/
13

24
.env
35
repomix-output*

json-java21-schema/src/main/java/io/github/simbo1905/json/schema/SchemaCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ private static JsonSchema compileInternalWithContext(Session session, JsonValue
626626
}
627627

628628
if (!(schemaJson instanceof JsonObject obj)) {
629-
throw new IllegalArgumentException("Schema must be an object or boolean");
629+
throw new IllegalArgumentException("Schema must be an object");
630630
}
631631

632632
// Process definitions first and build pointer index

json-java21-schema/src/test/java/io/github/simbo1905/json/schema/JsonSchemaCheckIT.java renamed to json-java21-schema/src/test/java/io/github/simbo1905/json/schema/JsonSchemaCheck202012IT.java

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.nio.file.Paths;
1616
import java.util.zip.ZipEntry;
1717
import java.util.zip.ZipInputStream;
18-
import java.util.concurrent.ConcurrentHashMap;
1918
import java.util.stream.Stream;
2019
import java.util.stream.StreamSupport;
2120

@@ -25,8 +24,7 @@
2524
/// By default, this is lenient and will SKIP mismatches and unsupported schemas
2625
/// to provide a compatibility signal without breaking the build. Enable strict
2726
/// mode with -Djson.schema.strict=true to make mismatches fail the build.
28-
/// Test data location: see src/test/resources/JSONSchemaTestSuite-20250921/DOWNLOAD_COMMANDS.md
29-
public class JsonSchemaCheckIT {
27+
public class JsonSchemaCheck202012IT {
3028

3129
private static final Path ZIP_FILE = Paths.get("src/test/resources/json-schema-test-suite-data.zip");
3230
private static final Path TARGET_SUITE_DIR = Paths.get("target/test-data/draft2020-12");
@@ -138,7 +136,7 @@ static Stream<DynamicTest> dynamicTestStream(Path file, JsonNode root) {
138136
perFile(file).run.increment();
139137
} catch (Exception e) {
140138
final var reason = e.getMessage() == null ? e.getClass().getSimpleName() : e.getMessage();
141-
System.err.println("[JsonSchemaCheckIT] Skipping test due to exception: "
139+
System.err.println("[JsonSchemaCheck202012IT] Skipping test due to exception: "
142140
+ groupDesc + " — " + reason + " (" + file.getFileName() + ")");
143141

144142
/// Count exception as skipped mismatch in strict metrics
@@ -163,7 +161,7 @@ static Stream<DynamicTest> dynamicTestStream(Path file, JsonNode root) {
163161
throw e;
164162
}
165163
} else if (expected != actual) {
166-
System.err.println("[JsonSchemaCheckIT] Mismatch (ignored): "
164+
System.err.println("[JsonSchemaCheck202012IT] Mismatch (ignored): "
167165
+ groupDesc + " — expected=" + expected + ", actual=" + actual
168166
+ " (" + file.getFileName() + ")");
169167

@@ -181,7 +179,7 @@ static Stream<DynamicTest> dynamicTestStream(Path file, JsonNode root) {
181179
} catch (Exception ex) {
182180
/// Unsupported schema for this group; emit a single skipped test for visibility
183181
final var reason = ex.getMessage() == null ? ex.getClass().getSimpleName() : ex.getMessage();
184-
System.err.println("[JsonSchemaCheckIT] Skipping group due to unsupported schema: "
182+
System.err.println("[JsonSchemaCheck202012IT] Skipping group due to unsupported schema: "
185183
+ groupDesc + " — " + reason + " (" + file.getFileName() + ")");
186184

187185
/// Count unsupported group skip
@@ -329,32 +327,3 @@ static String buildCsvSummary(boolean strict, String timestamp) {
329327
}
330328
}
331329

332-
/// Thread-safe metrics container for the JSON Schema Test Suite run.
333-
/// Thread-safe strict metrics container for the JSON Schema Test Suite run
334-
final class StrictMetrics {
335-
final java.util.concurrent.atomic.LongAdder total = new java.util.concurrent.atomic.LongAdder();
336-
final java.util.concurrent.atomic.LongAdder run = new java.util.concurrent.atomic.LongAdder();
337-
final java.util.concurrent.atomic.LongAdder passed = new java.util.concurrent.atomic.LongAdder();
338-
final java.util.concurrent.atomic.LongAdder failed = new java.util.concurrent.atomic.LongAdder();
339-
final java.util.concurrent.atomic.LongAdder skippedUnsupported = new java.util.concurrent.atomic.LongAdder();
340-
final java.util.concurrent.atomic.LongAdder skippedMismatch = new java.util.concurrent.atomic.LongAdder();
341-
342-
// Legacy counters for backward compatibility
343-
final java.util.concurrent.atomic.LongAdder groupsDiscovered = new java.util.concurrent.atomic.LongAdder();
344-
final java.util.concurrent.atomic.LongAdder testsDiscovered = new java.util.concurrent.atomic.LongAdder();
345-
final java.util.concurrent.atomic.LongAdder skipTestException = new java.util.concurrent.atomic.LongAdder();
346-
347-
final ConcurrentHashMap<String, FileCounters> perFile = new ConcurrentHashMap<>();
348-
349-
/// Per-file counters for detailed metrics
350-
static final class FileCounters {
351-
final java.util.concurrent.atomic.LongAdder groups = new java.util.concurrent.atomic.LongAdder();
352-
final java.util.concurrent.atomic.LongAdder tests = new java.util.concurrent.atomic.LongAdder();
353-
final java.util.concurrent.atomic.LongAdder run = new java.util.concurrent.atomic.LongAdder();
354-
final java.util.concurrent.atomic.LongAdder pass = new java.util.concurrent.atomic.LongAdder();
355-
final java.util.concurrent.atomic.LongAdder fail = new java.util.concurrent.atomic.LongAdder();
356-
final java.util.concurrent.atomic.LongAdder skipUnsupported = new java.util.concurrent.atomic.LongAdder();
357-
final java.util.concurrent.atomic.LongAdder skipException = new java.util.concurrent.atomic.LongAdder();
358-
final java.util.concurrent.atomic.LongAdder skipMismatch = new java.util.concurrent.atomic.LongAdder();
359-
}
360-
}

0 commit comments

Comments
 (0)