From 6b8fc9c4d3b638f84324b9efe854513c8c2e4e42 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 18 Dec 2023 16:11:09 -0800 Subject: [PATCH] Fixes the issue with the checker framework --- .../client/schemas/validation/JsonSchema.java | 15 ---------- .../validation/ListSchemaValidator.java | 13 --------- .../validation/MapSchemaValidator.java | 14 ---------- .../validation/ValidationMetadata.java | 25 ----------------- .../validation/CustomIsoparserTest.java | 28 ------------------- 5 files changed, 95 deletions(-) delete mode 100644 samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java delete mode 100644 samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java delete mode 100644 samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.java delete mode 100644 samples/client/3_0_3_unit_test/java_simplified/src/test/java/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.java diff --git a/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index a4455ac38e27..87def7942dcf 100644 --- a/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -23,19 +23,4 @@ public abstract class JsonSchema { protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { this.type = jsonSchemaInfo.type; } - - public static class PathToSchemasMap extends LinkedHashMap, LinkedHashMap> { - - public void update(PathToSchemasMap other) { - for (Map.Entry, LinkedHashMap> entry: other.entrySet()) { - List pathToItem = entry.getKey(); - LinkedHashMap otherSchemas = entry.getValue(); - if (containsKey(pathToItem)) { - get(pathToItem).putAll(otherSchemas); - } else { - put(pathToItem, otherSchemas); - } - } - } - } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java deleted file mode 100644 index 35d7d3c00b53..000000000000 --- a/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; - -import java.util.List; -import java.util.Set; - -public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, JsonSchema.PathToSchemasMap pathToSchemas); - OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; -} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java deleted file mode 100644 index e50d21e94375..000000000000 --- a/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, JsonSchema.PathToSchemasMap pathToSchemas); - OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; -} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.java b/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.java deleted file mode 100644 index 117aa0420bff..000000000000 --- a/samples/client/3_0_3_unit_test/java_simplified/src/main/java/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public record ValidationMetadata( - List pathToItem, - SchemaConfiguration configuration, - JsonSchema.PathToSchemasMap validatedPathToSchemas, - Set> seenClasses -) { - - public boolean validationRanEarlier(JsonSchema schema) { - Map validatedSchemas = validatedPathToSchemas.getOrDefault(pathToItem, null); - if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { - return true; - } - if (seenClasses.contains(schema)) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java_simplified/src/test/java/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.java b/samples/client/3_0_3_unit_test/java_simplified/src/test/java/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.java deleted file mode 100644 index 686612d46c42..000000000000 --- a/samples/client/3_0_3_unit_test/java_simplified/src/test/java/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.openapijsonschematools.client.schemas.validation; - -import java.time.LocalDate; -import java.time.ZonedDateTime; -import java.time.ZoneId; -import org.junit.Assert; -import org.junit.Test; - -public final class CustomIsoparserTest { - - @Test - public void testParseIsodatetime() { - final CustomIsoparser parser = new CustomIsoparser(); - ZonedDateTime dateTime = parser.parseIsodatetime("2017-07-21T17:32:28Z"); - ZoneId zone = ZoneId.of("Z"); - ZonedDateTime expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone); - Assert.assertEquals(dateTime, expectedDateTime); - } - - @Test - public void testParseIsodate() { - final CustomIsoparser parser = new CustomIsoparser(); - LocalDate date = parser.parseIsodate("2017-07-21"); - LocalDate expectedDate = LocalDate.of(2017, 7, 21); - Assert.assertEquals(date, expectedDate); - } - -} \ No newline at end of file