From f42deb1efa731068bdc2130cd00d48035cc22e08 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 15 Dec 2023 12:51:28 -0800 Subject: [PATCH 01/16] Updates FrozenList/Map to use AbstractList/Map --- .../client/schemas/validation/FrozenList.java | 46 +++--------- .../client/schemas/validation/FrozenMap.java | 72 +++--------------- .../schemas/validation/FrozenList.hbs | 47 ++++-------- .../schemas/validation/FrozenMap.hbs | 73 +++---------------- 4 files changed, 44 insertions(+), 194 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java index 1790d2408b2..743aef36dbf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java @@ -1,51 +1,29 @@ package org.openapijsonschematools.client.schemas.validation; +import java.util.AbstractList; import java.util.ArrayList; import java.util.Collection; +import java.util.List; -public class FrozenList extends ArrayList { +public class FrozenList extends AbstractList { /* A frozen List Once schema validation has been run, indexed access returns values of the correct type If values were mutable, the types in those methods would not agree with returned values */ + private final List list; public FrozenList(Collection m) { - super(m); + super(); + list = new ArrayList<>(m); } - public boolean add(E e) { - throw new UnsupportedOperationException(); + @Override + public E get(int index) { + return list.get(index); } - public void add(int index, E element) { - throw new UnsupportedOperationException(); - } - - public E remove(int index) { - throw new UnsupportedOperationException(); - } - - public boolean remove(Object o) { - throw new UnsupportedOperationException(); - } - - public void clear() { - throw new UnsupportedOperationException(); - } - - public boolean addAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean addAll(int index, Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException(); + @Override + public int size() { + return list.size(); } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java index f70600de9f3..491aa59d584 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java @@ -3,20 +3,22 @@ import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import java.util.LinkedHashMap; +import java.util.AbstractMap; +import java.util.HashMap; import java.util.Map; import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.Function; -public class FrozenMap extends LinkedHashMap { +public class FrozenMap extends AbstractMap { /* A frozen Map Once schema validation has been run, written accessor methods return values of the correct type If values were mutable, the types in those methods would not agree with returned values */ + private final Map map; public FrozenMap(Map m) { - super(m); + + super(); + map = new HashMap<>(m); } protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { @@ -31,64 +33,8 @@ protected void throwIfKeyKnown(String key, Set requiredKeys, Set } } - public V put(String key, V value) { - throw new UnsupportedOperationException(); - } - public V remove(Object key) { - throw new UnsupportedOperationException(); - } - public void putAll(Map m) { - throw new UnsupportedOperationException(); - } - public void clear() { - throw new UnsupportedOperationException(); - } - - @Override - public void replaceAll(BiFunction function) { - throw new UnsupportedOperationException(); - } - - @Override - public V putIfAbsent(String key, V value) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean remove(Object key, Object value) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean replace(String key, V oldValue, V newValue) { - throw new UnsupportedOperationException(); - } - - @Override - public V replace(String key, V value) { - throw new UnsupportedOperationException(); - } - - @Override - public V computeIfAbsent(String key, Function mappingFunction) { - throw new UnsupportedOperationException(); - } - - @Override - public V computeIfPresent(String key, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); - } - - @Override - public V compute(String key, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); - } - @Override - public V merge(String key, V value, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); + public Set> entrySet() { + return map.entrySet(); } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs index ded2345d16e..6711610f68a 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenList.hbs @@ -1,51 +1,30 @@ package {{{packageName}}}.schemas.validation; +import java.util.AbstractList; import java.util.ArrayList; import java.util.Collection; +import java.util.List; -public class FrozenList extends ArrayList { +public class FrozenList extends AbstractList { /* A frozen List Once schema validation has been run, indexed access returns values of the correct type If values were mutable, the types in those methods would not agree with returned values */ + private final List list; public FrozenList(Collection m) { - super(m); + super(); + list = new ArrayList<>(m); } - public boolean add(E e) { - throw new UnsupportedOperationException(); + @Override + public E get(int index) { + return list.get(index); } - public void add(int index, E element) { - throw new UnsupportedOperationException(); - } - - public E remove(int index) { - throw new UnsupportedOperationException(); - } - - public boolean remove(Object o) { - throw new UnsupportedOperationException(); - } - - public void clear() { - throw new UnsupportedOperationException(); - } - - public boolean addAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean addAll(int index, Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException(); + @Override + public int size() { + return list.size(); } } + diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs index fc57cf1727c..8d86dcc0801 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FrozenMap.hbs @@ -3,20 +3,22 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.exceptions.UnsetPropertyException; import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException; -import java.util.LinkedHashMap; +import java.util.AbstractMap; +import java.util.HashMap; import java.util.Map; import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.Function; -public class FrozenMap extends LinkedHashMap { +public class FrozenMap extends AbstractMap { /* A frozen Map Once schema validation has been run, written accessor methods return values of the correct type If values were mutable, the types in those methods would not agree with returned values */ + private final Map map; public FrozenMap(Map m) { - super(m); + + super(); + map = new HashMap<>(m); } protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { @@ -31,64 +33,9 @@ public class FrozenMap extends LinkedHashMap { } } - public V put(String key, V value) { - throw new UnsupportedOperationException(); - } - public V remove(Object key) { - throw new UnsupportedOperationException(); - } - public void putAll(Map m) { - throw new UnsupportedOperationException(); - } - public void clear() { - throw new UnsupportedOperationException(); - } - - @Override - public void replaceAll(BiFunction function) { - throw new UnsupportedOperationException(); - } - - @Override - public V putIfAbsent(String key, V value) { - throw new UnsupportedOperationException(); - } - @Override - public boolean remove(Object key, Object value) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean replace(String key, V oldValue, V newValue) { - throw new UnsupportedOperationException(); - } - - @Override - public V replace(String key, V value) { - throw new UnsupportedOperationException(); - } - - @Override - public V computeIfAbsent(String key, Function mappingFunction) { - throw new UnsupportedOperationException(); - } - - @Override - public V computeIfPresent(String key, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); - } - - @Override - public V compute(String key, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); - } - - @Override - public V merge(String key, V value, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); + public Set> entrySet() { + return map.entrySet(); } } + From 65c641a39cd1fde090680f6ea7c2f3fb8906c9d7 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 16 Dec 2023 12:01:47 -0800 Subject: [PATCH 02/16] Refactors castToAllowedTypes into JsonSchema --- ...rtiesAllowsASchemaWhichShouldValidate.java | 17 +- ...ditionalpropertiesAreAllowedByDefault.java | 39 ----- .../AdditionalpropertiesCanExistByItself.java | 17 +- ...lpropertiesShouldNotLookInApplicators.java | 78 --------- .../client/components/schemas/Allof.java | 117 ------------- .../schemas/AllofCombinedWithAnyofOneof.java | 156 ------------------ .../components/schemas/AllofSimpleTypes.java | 117 ------------- .../schemas/AllofWithBaseSchema.java | 117 ------------- .../schemas/AllofWithOneEmptySchema.java | 39 ----- .../schemas/AllofWithTheFirstEmptySchema.java | 39 ----- .../schemas/AllofWithTheLastEmptySchema.java | 39 ----- .../schemas/AllofWithTwoEmptySchemas.java | 39 ----- .../client/components/schemas/Anyof.java | 78 --------- .../components/schemas/AnyofComplexTypes.java | 117 ------------- .../schemas/AnyofWithBaseSchema.java | 83 ---------- .../schemas/AnyofWithOneEmptySchema.java | 39 ----- .../schemas/ArrayTypeMatchesArrays.java | 15 -- .../client/components/schemas/ByInt.java | 39 ----- .../client/components/schemas/ByNumber.java | 39 ----- .../components/schemas/BySmallNumber.java | 39 ----- .../components/schemas/DateTimeFormat.java | 39 ----- .../components/schemas/EmailFormat.java | 39 ----- .../schemas/EnumWith0DoesNotMatchFalse.java | 5 - .../schemas/EnumWith1DoesNotMatchTrue.java | 5 - .../schemas/EnumWithEscapedCharacters.java | 5 - .../schemas/EnumWithFalseDoesNotMatch0.java | 5 - .../schemas/EnumWithTrueDoesNotMatch1.java | 5 - .../components/schemas/EnumsInProperties.java | 27 +-- .../components/schemas/ForbiddenProperty.java | 39 ----- .../components/schemas/HostnameFormat.java | 39 ----- ...ouldNotRaiseErrorWhenFloatDivisionInf.java | 5 - .../schemas/InvalidStringValueForDefault.java | 44 ----- .../client/components/schemas/Ipv4Format.java | 39 ----- .../client/components/schemas/Ipv6Format.java | 39 ----- .../components/schemas/JsonPointerFormat.java | 39 ----- .../components/schemas/MaximumValidation.java | 39 ----- .../MaximumValidationWithUnsignedInteger.java | 39 ----- .../schemas/MaxitemsValidation.java | 39 ----- .../schemas/MaxlengthValidation.java | 39 ----- .../Maxproperties0MeansTheObjectIsEmpty.java | 39 ----- .../schemas/MaxpropertiesValidation.java | 39 ----- .../components/schemas/MinimumValidation.java | 39 ----- .../MinimumValidationWithSignedInteger.java | 39 ----- .../schemas/MinitemsValidation.java | 39 ----- .../schemas/MinlengthValidation.java | 39 ----- .../schemas/MinpropertiesValidation.java | 39 ----- ...NestedAllofToCheckValidationSemantics.java | 78 --------- ...NestedAnyofToCheckValidationSemantics.java | 78 --------- .../components/schemas/NestedItems.java | 60 ------- ...NestedOneofToCheckValidationSemantics.java | 78 --------- .../client/components/schemas/Not.java | 39 ----- .../schemas/NotMoreComplexSchema.java | 56 +------ .../schemas/NulCharactersInStrings.java | 5 - .../schemas/ObjectPropertiesValidation.java | 39 ----- .../client/components/schemas/Oneof.java | 78 --------- .../components/schemas/OneofComplexTypes.java | 117 ------------- .../schemas/OneofWithBaseSchema.java | 83 ---------- .../schemas/OneofWithEmptySchema.java | 39 ----- .../components/schemas/OneofWithRequired.java | 95 +---------- .../schemas/PatternIsNotAnchored.java | 39 ----- .../components/schemas/PatternValidation.java | 39 ----- .../PropertiesWithEscapedCharacters.java | 39 ----- .../PropertyNamedRefThatIsNotAReference.java | 39 ----- .../schemas/RefInAdditionalproperties.java | 17 +- .../client/components/schemas/RefInAllof.java | 39 ----- .../client/components/schemas/RefInAnyof.java | 39 ----- .../client/components/schemas/RefInItems.java | 15 -- .../client/components/schemas/RefInNot.java | 39 ----- .../client/components/schemas/RefInOneof.java | 39 ----- .../components/schemas/RefInProperty.java | 39 ----- .../schemas/RequiredDefaultValidation.java | 39 ----- .../schemas/RequiredValidation.java | 39 ----- .../schemas/RequiredWithEmptyArray.java | 39 ----- .../RequiredWithEscapedCharacters.java | 39 ----- .../schemas/SimpleEnumValidation.java | 5 - ...esNotDoAnythingIfThePropertyIsMissing.java | 22 +-- .../schemas/UniqueitemsFalseValidation.java | 39 ----- .../schemas/UniqueitemsValidation.java | 39 ----- .../client/components/schemas/UriFormat.java | 39 ----- .../schemas/UriReferenceFormat.java | 39 ----- .../components/schemas/UriTemplateFormat.java | 39 ----- .../client/schemas/AnyTypeJsonSchema.java | 32 +--- .../client/schemas/ListJsonSchema.java | 9 +- .../client/schemas/MapJsonSchema.java | 9 +- .../client/schemas/NotAnyTypeJsonSchema.java | 31 +--- .../client/schemas/validation/FrozenList.java | 1 + .../client/schemas/validation/FrozenMap.java | 1 + .../client/schemas/validation/JsonSchema.java | 51 ++---- .../validation/ListSchemaValidator.java | 5 +- .../validation/MapSchemaValidator.java | 5 +- .../validation/UnsetAnyTypeJsonSchema.java | 30 ---- .../schemas/SchemaClass/_Schema_map.hbs | 2 +- .../SchemaClass/_validate_implementor.hbs | 98 ----------- .../packagename/schemas/AnyTypeJsonSchema.hbs | 32 +--- .../packagename/schemas/ListJsonSchema.hbs | 9 +- .../packagename/schemas/MapJsonSchema.hbs | 9 +- .../schemas/NotAnyTypeJsonSchema.hbs | 31 +--- .../schemas/validation/JsonSchema.hbs | 51 ++---- .../validation/ListSchemaValidator.hbs | 5 +- .../schemas/validation/MapSchemaValidator.hbs | 5 +- .../validation/UnsetAnyTypeJsonSchema.hbs | 30 ---- 101 files changed, 62 insertions(+), 4056 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index 8f4782ad85d..8cc8f7bdaef 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -70,7 +70,7 @@ public static class AdditionalpropertiesAllowsASchemaWhichShouldValidateMapInput } - public static class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 extends JsonSchema implements MapSchemaValidator { + public static class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -97,21 +97,6 @@ public static AdditionalpropertiesAllowsASchemaWhichShouldValidate1 getInstance( return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index ea293faf130..c4669f2b2ff 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -99,10 +99,6 @@ public static AdditionalpropertiesAreAllowedByDefault1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -122,11 +118,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -145,11 +136,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -184,11 +170,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -219,11 +200,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -242,21 +218,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index 5d37cdecf52..f8609db1b1b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -47,7 +47,7 @@ public static class AdditionalpropertiesCanExistByItselfMapInput { } - public static class AdditionalpropertiesCanExistByItself1 extends JsonSchema implements MapSchemaValidator { + public static class AdditionalpropertiesCanExistByItself1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -70,21 +70,6 @@ public static AdditionalpropertiesCanExistByItself1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Boolean val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Boolean fixedVal = (Boolean) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - public AdditionalpropertiesCanExistByItselfMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 474efc5c533..0957d2a7ec2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -87,10 +87,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -110,11 +106,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -133,11 +124,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +158,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -207,11 +188,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -230,21 +206,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -340,10 +301,6 @@ public static AdditionalpropertiesShouldNotLookInApplicators1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -363,11 +320,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -386,11 +338,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -425,11 +372,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -460,11 +402,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -483,21 +420,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Boolean val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Boolean fixedVal = (Boolean) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index 745e5febbe3..5f390e65a47 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -84,10 +84,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -107,11 +103,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -130,11 +121,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -169,11 +155,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -204,11 +185,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -227,21 +203,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -343,10 +304,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -366,11 +323,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -389,11 +341,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -428,11 +375,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -463,11 +405,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -486,21 +423,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -576,10 +498,6 @@ public static Allof1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -599,11 +517,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -622,11 +535,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -661,11 +569,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -696,11 +599,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -719,21 +617,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index 853ba592f38..2e2ced5444f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -47,10 +47,6 @@ public static Schema02 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -70,11 +66,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -93,11 +84,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -132,11 +118,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -167,11 +148,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -190,21 +166,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -260,10 +221,6 @@ public static Schema01 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -283,11 +240,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -306,11 +258,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -345,11 +292,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -380,11 +322,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -403,21 +340,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -473,10 +395,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -496,11 +414,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -519,11 +432,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -558,11 +466,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -593,11 +496,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -616,21 +514,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -700,10 +583,6 @@ public static AllofCombinedWithAnyofOneof1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -723,11 +602,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -746,11 +620,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -785,11 +654,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -820,11 +684,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -843,21 +702,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index d36ee405a4b..9c20744a41e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -46,10 +46,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -69,11 +65,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -92,11 +83,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -131,11 +117,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -166,11 +147,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -189,21 +165,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -259,10 +220,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -282,11 +239,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -305,11 +257,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -344,11 +291,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -379,11 +321,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -402,21 +339,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -481,10 +403,6 @@ public static AllofSimpleTypes1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -504,11 +422,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -527,11 +440,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -566,11 +474,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -601,11 +504,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -624,21 +522,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index 88fe2d8c376..a16a222b357 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -85,10 +85,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -108,11 +104,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -131,11 +122,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -170,11 +156,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -205,11 +186,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -228,21 +204,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -344,10 +305,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -367,11 +324,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -390,11 +342,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -429,11 +376,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -464,11 +406,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -487,21 +424,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -613,10 +535,6 @@ public static AllofWithBaseSchema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -636,11 +554,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -659,11 +572,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -698,11 +606,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -733,11 +636,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -756,21 +654,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public AllofWithBaseSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 05e4a7ee5b8..f37ee92fad0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -58,10 +58,6 @@ public static AllofWithOneEmptySchema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -81,11 +77,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -104,11 +95,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -143,11 +129,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -178,11 +159,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -201,21 +177,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 51c432e2243..9ef49602c3a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -63,10 +63,6 @@ public static AllofWithTheFirstEmptySchema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -86,11 +82,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -109,11 +100,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -148,11 +134,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -183,11 +164,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -206,21 +182,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index f60c3ac85a0..8c3d5e6b3d5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -63,10 +63,6 @@ public static AllofWithTheLastEmptySchema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -86,11 +82,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -109,11 +100,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -148,11 +134,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -183,11 +164,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -206,21 +182,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index 27ff18e19d5..323b117d6a3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -62,10 +62,6 @@ public static AllofWithTwoEmptySchemas1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -85,11 +81,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -108,11 +99,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -147,11 +133,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -182,11 +163,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -205,21 +181,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 5e4d4099982..aa66ed30c85 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -50,10 +50,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -73,11 +69,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -96,11 +87,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -135,11 +121,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -170,11 +151,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -193,21 +169,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -272,10 +233,6 @@ public static Anyof1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -295,11 +252,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -318,11 +270,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -357,11 +304,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -392,11 +334,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -415,21 +352,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index d5e8089d6fc..03f222511e7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -84,10 +84,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -107,11 +103,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -130,11 +121,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -169,11 +155,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -204,11 +185,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -227,21 +203,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -343,10 +304,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -366,11 +323,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -389,11 +341,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -428,11 +375,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -463,11 +405,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -486,21 +423,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -576,10 +498,6 @@ public static AnyofComplexTypes1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -599,11 +517,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -622,11 +535,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -661,11 +569,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -696,11 +599,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -719,21 +617,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index 61178e5ef81..4ee22284dba 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -46,10 +46,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -69,11 +65,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -92,11 +83,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -131,11 +117,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -166,11 +147,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -189,21 +165,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -259,10 +220,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -282,11 +239,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -305,11 +257,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -344,11 +291,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -379,11 +321,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -402,21 +339,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -485,11 +407,6 @@ public static AnyofWithBaseSchema1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index c5f5b892800..d9354e597b1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -63,10 +63,6 @@ public static AnyofWithOneEmptySchema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -86,11 +82,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -109,11 +100,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -148,11 +134,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -183,11 +164,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -206,21 +182,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 5f44a1e9d11..177ef8157fd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -63,21 +63,6 @@ public static ArrayTypeMatchesArrays1 getInstance() { return instance; } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = (Object) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - @Override public ArrayTypeMatchesArraysList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index ea1869a4001..da90a25635d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -53,10 +53,6 @@ public static ByInt1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -76,11 +72,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -99,11 +90,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -138,11 +124,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -173,11 +154,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -196,21 +172,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index ba3593ed971..69661ced328 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -53,10 +53,6 @@ public static ByNumber1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -76,11 +72,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -99,11 +90,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -138,11 +124,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -173,11 +154,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -196,21 +172,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index 4a0e7044b4e..4a01b764df7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -53,10 +53,6 @@ public static BySmallNumber1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -76,11 +72,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -99,11 +90,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -138,11 +124,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -173,11 +154,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -196,21 +172,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index 67e70642291..36a555f5ecb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -52,10 +52,6 @@ public static DateTimeFormat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index 2f1c0ca6187..020f39f4650 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -52,10 +52,6 @@ public static EmailFormat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java index f202e396000..54040176335 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java @@ -52,11 +52,6 @@ public static EnumWith0DoesNotMatchFalse1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java index c5ac2c58bb2..c1b4c4fac37 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java @@ -52,11 +52,6 @@ public static EnumWith1DoesNotMatchTrue1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java index 47bde76570a..4dbc08d52bc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java @@ -50,11 +50,6 @@ public static EnumWithEscapedCharacters1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java index 8ba976b6de0..c0f1836feae 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java @@ -47,11 +47,6 @@ public static EnumWithFalseDoesNotMatch01 getInstance() { return instance; } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java index 0c6ab1a5d46..292c845de66 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java @@ -47,11 +47,6 @@ public static EnumWithTrueDoesNotMatch11 getInstance() { return instance; } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index f32d6b8df58..136d4841da3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -46,11 +46,6 @@ public static Foo getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -97,11 +92,6 @@ public static Bar getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -162,7 +152,7 @@ public static class EnumsInPropertiesMapInput { } - public static class EnumsInProperties1 extends JsonSchema implements MapSchemaValidator { + public static class EnumsInProperties1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -191,21 +181,6 @@ public static EnumsInProperties1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - public EnumsInPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 138bdb1a724..52370d0112e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -90,10 +90,6 @@ public static ForbiddenProperty1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -113,11 +109,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -136,11 +127,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -175,11 +161,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -210,11 +191,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -233,21 +209,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public ForbiddenPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index d8b366c9923..4c27f4ef621 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -52,10 +52,6 @@ public static HostnameFormat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java index e7b565c2e31..19352695a36 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java @@ -50,11 +50,6 @@ public static InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1 getInstanc return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index 562122faab3..96939e0c7f7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -51,11 +51,6 @@ public static Bar getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -133,10 +128,6 @@ public static InvalidStringValueForDefault1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -156,11 +147,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -179,11 +165,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -218,11 +199,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -253,11 +229,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -276,21 +247,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public InvalidStringValueForDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index a38fa99d8d7..8527cd14526 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -52,10 +52,6 @@ public static Ipv4Format1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index 357b9f89f3a..54f09df5690 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -52,10 +52,6 @@ public static Ipv6Format1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index da9ab549fd3..1fcac7b6ca6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -52,10 +52,6 @@ public static JsonPointerFormat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index 8fe6d13b17e..1fb70ecbe1c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -52,10 +52,6 @@ public static MaximumValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 31dfff06af1..d7360c8eec8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -52,10 +52,6 @@ public static MaximumValidationWithUnsignedInteger1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index 03825dec966..13e4dc176ad 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -52,10 +52,6 @@ public static MaxitemsValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 08cadd65ae9..4ae4d5a2fe7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -52,10 +52,6 @@ public static MaxlengthValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index 68f4eea8dec..ace8a0e443a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -52,10 +52,6 @@ public static Maxproperties0MeansTheObjectIsEmpty1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 8b938684f36..2f868fc71b8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -52,10 +52,6 @@ public static MaxpropertiesValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index a64605a54f7..a361914b7b9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -52,10 +52,6 @@ public static MinimumValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 84a2d48e9e9..189d4231e21 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -52,10 +52,6 @@ public static MinimumValidationWithSignedInteger1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 5ea540428fd..7f8c63dba7b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -52,10 +52,6 @@ public static MinitemsValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index a1e75af5c59..28747e379c1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -52,10 +52,6 @@ public static MinlengthValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index e01d51a5233..19bbef069c5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -52,10 +52,6 @@ public static MinpropertiesValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index 297aa08e22c..be4977c1949 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -52,10 +52,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -273,10 +234,6 @@ public static NestedAllofToCheckValidationSemantics1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -296,11 +253,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -319,11 +271,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -358,11 +305,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -393,11 +335,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -416,21 +353,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index f1ae5068773..0733450e903 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -52,10 +52,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -273,10 +234,6 @@ public static NestedAnyofToCheckValidationSemantics1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -296,11 +253,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -319,11 +271,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -358,11 +305,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -393,11 +335,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -416,21 +353,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index f9a9ac2845d..3bf7b1c18e8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -57,21 +57,6 @@ public static Items2 getInstance() { return instance; } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Number item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Number fixedVal = (Number) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - @Override public ItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); @@ -140,21 +125,6 @@ public static Items1 getInstance() { return instance; } - @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (List item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenList fixedVal = (FrozenList) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - @Override public ItemsList1 getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); @@ -223,21 +193,6 @@ public static Items getInstance() { return instance; } - @Override - public FrozenList>> castToAllowedTypes(List>> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List>> argFixed = new ArrayList<>(); - int i =0; - for (List> item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenList> fixedVal = (FrozenList>) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - @Override public ItemsList2 getNewInstance(FrozenList>> arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); @@ -312,21 +267,6 @@ public static NestedItems1 getInstance() { return instance; } - @Override - public FrozenList>>> castToAllowedTypes(List>>> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List>>> argFixed = new ArrayList<>(); - int i =0; - for (List>> item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenList>> fixedVal = (FrozenList>>) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - @Override public NestedItemsList getNewInstance(FrozenList>>> arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index 4a1ff21adb5..053bd9d1aaa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -52,10 +52,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -273,10 +234,6 @@ public static NestedOneofToCheckValidationSemantics1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -296,11 +253,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -319,11 +271,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -358,11 +305,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -393,11 +335,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -416,21 +353,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 8de1900b986..4b976617a77 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -56,10 +56,6 @@ public static Not1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -79,11 +75,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -102,11 +93,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -141,11 +127,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -176,11 +157,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -199,21 +175,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 1c0a7d6b741..871993170fc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -65,7 +65,7 @@ public static class NotMapInput { } - public static class Not extends JsonSchema implements MapSchemaValidator { + public static class Not extends JsonSchema implements MapSchemaValidator { private static Not instance; protected Not() { @@ -84,21 +84,6 @@ public static Not getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - public NotMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @@ -158,10 +143,6 @@ public static NotMoreComplexSchema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -181,11 +162,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -204,11 +180,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -243,11 +214,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -278,11 +244,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -301,21 +262,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java index 33cd08287c7..2cab2557e9f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java @@ -49,11 +49,6 @@ public static NulCharactersInStrings1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index 786bf6b093d..a1899e1c3e6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -100,10 +100,6 @@ public static ObjectPropertiesValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -123,11 +119,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -146,11 +137,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -185,11 +171,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -220,11 +201,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -243,21 +219,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public ObjectPropertiesValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index c65fe658de1..45344604873 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -50,10 +50,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -73,11 +69,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -96,11 +87,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -135,11 +121,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -170,11 +151,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -193,21 +169,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -272,10 +233,6 @@ public static Oneof1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -295,11 +252,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -318,11 +270,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -357,11 +304,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -392,11 +334,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -415,21 +352,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 8afb055383d..6798c69e45f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -84,10 +84,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -107,11 +103,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -130,11 +121,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -169,11 +155,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -204,11 +185,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -227,21 +203,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -343,10 +304,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -366,11 +323,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -389,11 +341,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -428,11 +375,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -463,11 +405,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -486,21 +423,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -576,10 +498,6 @@ public static OneofComplexTypes1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -599,11 +517,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -622,11 +535,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -661,11 +569,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -696,11 +599,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -719,21 +617,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index d4d12aa7061..623175d1a89 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -46,10 +46,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -69,11 +65,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -92,11 +83,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -131,11 +117,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -166,11 +147,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -189,21 +165,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -259,10 +220,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -282,11 +239,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -305,11 +257,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -344,11 +291,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -379,11 +321,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -402,21 +339,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -485,11 +407,6 @@ public static OneofWithBaseSchema1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 56857ad28b3..334bc101e2d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -63,10 +63,6 @@ public static OneofWithEmptySchema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -86,11 +82,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -109,11 +100,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -148,11 +134,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -183,11 +164,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -206,21 +182,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index d443e016e87..a4d1cf9bf4f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -81,10 +81,6 @@ public static Schema0 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -104,11 +100,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -127,11 +118,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -166,11 +152,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -201,11 +182,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -224,21 +200,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -340,10 +301,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -363,11 +320,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -386,11 +338,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -425,11 +372,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -460,11 +402,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -483,21 +420,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); @@ -549,7 +471,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class OneofWithRequired1 extends JsonSchema implements MapSchemaValidator> { + public static class OneofWithRequired1 extends JsonSchema implements MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -575,21 +497,6 @@ public static OneofWithRequired1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 184d94c9ce7..3dc8a0103f6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -55,10 +55,6 @@ public static PatternIsNotAnchored1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -78,11 +74,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -101,11 +92,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -140,11 +126,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -175,11 +156,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -198,21 +174,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 537b9cb68db..43861398dd2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -55,10 +55,6 @@ public static PatternValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -78,11 +74,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -101,11 +92,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -140,11 +126,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -175,11 +156,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -198,21 +174,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index 3f7158276b7..cc67b0ac43e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -107,10 +107,6 @@ public static PropertiesWithEscapedCharacters1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -130,11 +126,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -153,11 +144,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -192,11 +178,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -227,11 +208,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -250,21 +226,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public PropertiesWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 08fd9fe1141..4f672ab448b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -82,10 +82,6 @@ public static PropertyNamedRefThatIsNotAReference1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -105,11 +101,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -128,11 +119,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -167,11 +153,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -202,11 +183,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -225,21 +201,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index e6db030de00..c20d50f5ded 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -43,7 +43,7 @@ public static class RefInAdditionalpropertiesMapInput { } - public static class RefInAdditionalproperties1 extends JsonSchema implements MapSchemaValidator { + public static class RefInAdditionalproperties1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -66,21 +66,6 @@ public static RefInAdditionalproperties1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - public RefInAdditionalpropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index 81af55b1540..e290c123ac1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -54,10 +54,6 @@ public static RefInAllof1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -77,11 +73,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -100,11 +91,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -139,11 +125,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -174,11 +155,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -197,21 +173,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index f8b78aa1407..5de912427e1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -54,10 +54,6 @@ public static RefInAnyof1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -77,11 +73,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -100,11 +91,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -139,11 +125,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -174,11 +155,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -197,21 +173,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index 0136b8aa3e3..e85c86b6074 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -59,21 +59,6 @@ public static RefInItems1 getInstance() { return instance; } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = (Object) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - @Override public RefInItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 94f24c2585c..cad9c2faeef 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -52,10 +52,6 @@ public static RefInNot1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 6bf4444ea57..d214130dc6a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -54,10 +54,6 @@ public static RefInOneof1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -77,11 +73,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -100,11 +91,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -139,11 +125,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -174,11 +155,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -197,21 +173,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index fb5103da7a6..30247a2f6c6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -84,10 +84,6 @@ public static RefInProperty1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -107,11 +103,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -130,11 +121,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -169,11 +155,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -204,11 +185,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -227,21 +203,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public RefInPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 77931e3ade8..67f03425588 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -88,10 +88,6 @@ public static RequiredDefaultValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -111,11 +107,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -134,11 +125,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -173,11 +159,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -208,11 +189,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -231,21 +207,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public RequiredDefaultValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index 8c6907416d8..deb5d1a7ecf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -101,10 +101,6 @@ public static RequiredValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -124,11 +120,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -147,11 +138,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -186,11 +172,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -221,11 +202,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -244,21 +220,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public RequiredValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 1408a7be4ff..fd6e3b687d0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -88,10 +88,6 @@ public static RequiredWithEmptyArray1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -111,11 +107,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -134,11 +125,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -173,11 +159,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -208,11 +189,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -231,21 +207,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public RequiredWithEmptyArrayMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 81e5970a840..61216ddd29b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -87,10 +87,6 @@ public static RequiredWithEscapedCharacters1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -110,11 +106,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -133,11 +124,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +158,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -207,11 +188,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -230,21 +206,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public RequiredWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java index d94d2e88f10..d7f60d57877 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java @@ -54,11 +54,6 @@ public static SimpleEnumValidation1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index d2b1cae87bf..fdca0d23326 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -46,11 +46,6 @@ public static Alpha getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -120,7 +115,7 @@ public static class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapI } - public static class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 extends JsonSchema implements MapSchemaValidator { + public static class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -145,21 +140,6 @@ public static TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 getInsta return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index c269dc21bc0..8a96a5d976c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -52,10 +52,6 @@ public static UniqueitemsFalseValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index 0efa4d9c1cd..c102ebae6af 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -52,10 +52,6 @@ public static UniqueitemsValidation1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index 00acb56174b..e2d2f6143dc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -52,10 +52,6 @@ public static UriFormat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index 3df20b562fd..f8e109944b5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -52,10 +52,6 @@ public static UriReferenceFormat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 7f8146fd56a..b4d54e76934 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -52,10 +52,6 @@ public static UriTemplateFormat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -75,11 +71,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -98,11 +89,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -137,11 +123,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -172,11 +153,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -195,21 +171,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index b134e61f6a5..fc5289c9aa3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -28,7 +28,7 @@ import java.util.Objects; import java.util.UUID; -public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static AnyTypeJsonSchema instance; protected AnyTypeJsonSchema() { @@ -42,11 +42,6 @@ public static AnyTypeJsonSchema getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -65,11 +60,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -88,11 +78,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -127,11 +112,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -162,11 +142,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -185,11 +160,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index bbc51abd047..aa9231afbf7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -21,7 +21,7 @@ import java.util.Objects; import java.util.Set; -public class ListJsonSchema extends JsonSchema implements ListSchemaValidator> { +public class ListJsonSchema extends JsonSchema implements ListSchemaValidator> { private static ListJsonSchema instance; protected ListJsonSchema() { @@ -37,11 +37,6 @@ public static ListJsonSchema getInstance() { return instance; } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -51,7 +46,7 @@ public FrozenList getNewInstance(FrozenList arg, List pa public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 0fbf5338dda..d1226e1a9aa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -21,7 +21,7 @@ import java.util.Objects; import java.util.Set; -public class MapJsonSchema extends JsonSchema implements MapSchemaValidator> { +public class MapJsonSchema extends JsonSchema implements MapSchemaValidator> { private static MapJsonSchema instance; protected MapJsonSchema() { @@ -37,11 +37,6 @@ public static MapJsonSchema getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -51,7 +46,7 @@ public FrozenMap getNewInstance(FrozenMap arg, List path public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index 7aef3092b9a..cb25bae4316 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -28,7 +28,7 @@ import java.util.LinkedHashMap; import java.util.Objects; -public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static NotAnyTypeJsonSchema instance; protected NotAnyTypeJsonSchema() { @@ -44,10 +44,6 @@ public static NotAnyTypeJsonSchema getInstance() { return instance; } - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; } @@ -64,11 +60,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -87,11 +78,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -110,11 +96,6 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -133,11 +114,6 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -156,11 +132,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java index 743aef36dbf..ab3ff21cbe1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java @@ -27,3 +27,4 @@ public int size() { return list.size(); } } + diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java index 491aa59d584..4851ae62d7a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java @@ -38,3 +38,4 @@ public Set> entrySet() { return map.entrySet(); } } + diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index a5cfa192d62..391f9ea77c1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -253,27 +253,27 @@ public static PathToSchemasMap validate( return pathToSchemas; } - protected String castToAllowedStringTypes(String arg, List pathToItem, Set> pathSet) { + protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Boolean castToAllowedBooleanTypes(Boolean arg, List pathToItem, Set> pathSet) { + protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Number castToAllowedNumberTypes(Number arg, List pathToItem, Set> pathSet) { + protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Void castToAllowedVoidTypes(Void arg, List pathToItem, Set> pathSet) { + protected Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected FrozenList castToAllowedListTypes(List arg, List pathToItem, Set> pathSet) { + protected FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; @@ -287,10 +287,10 @@ protected FrozenList castToAllowedListTypes(List arg, List(argFixed); } - protected FrozenMap castToAllowedMapTypes(Map arg, List pathToItem, Set> pathSet) { + protected FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: ((Map) arg).entrySet()) { + for (Map.Entry entry: arg.entrySet()) { String key = (String) entry.getKey(); Object val = entry.getValue(); List newPathToItem = new ArrayList<>(pathToItem); @@ -303,43 +303,24 @@ protected FrozenMap castToAllowedMapTypes(Map arg, List< protected Object castToAllowedObjectTypes(Object arg, List pathToItem, Set> pathSet) { if (arg == null) { - return castToAllowedVoidTypes((Void) arg, pathToItem, pathSet); + return castToAllowedTypes((Void) arg, pathToItem, pathSet); } else if (arg instanceof String) { - return castToAllowedStringTypes((String) arg, pathToItem, pathSet); + return castToAllowedTypes((String) arg, pathToItem, pathSet); } else if (arg instanceof Map) { pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: ((Map) arg).entrySet()) { - String key = (String) entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); + return castToAllowedTypes((Map) arg, pathToItem, pathSet); } else if (arg instanceof Boolean) { - return castToAllowedBooleanTypes((Boolean) arg, pathToItem, pathSet); + return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); } else if (arg instanceof Integer) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Long) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Float) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Double) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof List) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: ((List) arg).toArray()) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); + return castToAllowedTypes((List arg, pathToItem, pathSet); } else if (arg instanceof ZonedDateTime) { return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); } else if (arg instanceof LocalDate) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index 5da300d98da..29a591d4240 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -7,8 +7,7 @@ import java.util.List; import java.util.Set; -public interface ListSchemaValidator { - FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet); - OutType getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas); +public interface ListSchemaValidator { + OutType getNewInstance(FrozenList arg, List pathToItem, 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/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 4c76d7040e9..417892e4649 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -8,8 +8,7 @@ import java.util.Map; import java.util.Set; -public interface MapSchemaValidator { - FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet); - OutType getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas); +public interface MapSchemaValidator { + OutType getNewInstance(FrozenMap arg, List pathToItem, 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/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 5de5ccacd7e..aa07ed96ac9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -27,11 +27,6 @@ public static UnsetAnyTypeJsonSchema getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -50,11 +45,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -73,11 +63,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -96,11 +81,6 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -119,11 +99,6 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -142,11 +117,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_map.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_map.hbs index 741cdf5b839..b13b8c46382 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_map.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_map.hbs @@ -1,6 +1,6 @@ -public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements MapSchemaValidator<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}}> { +public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements MapSchemaValidator<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}}> { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index 78c50e8375d..df87c35faf4 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -2,11 +2,6 @@ {{#each types}} {{#eq this "null"}} -@Override -public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); -} - @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -25,21 +20,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat {{/eq}} {{#eq this "object"}} -@Override -public FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castToAllowedTypes(Map src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> argFixed = new LinkedHashMap<>(); - for (Map.Entry src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> entry: arg.entrySet()) { - String key = entry.getKey(); - {{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - {{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} fixedVal = ({{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); -} - {{#if ../mapOutputJsonPathPiece}} public {{../mapOutputJsonPathPiece.camelCase}} getNewInstance(FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> properties = new LinkedHashMap<>(); @@ -76,21 +56,6 @@ public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.camelCase}}{ {{/eq}} {{#eq this "array"}} -@Override -public FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castToAllowedTypes(List<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> argFixed = new ArrayList<>(); - int i =0; - for ({{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - {{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} fixedVal = ({{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); -} - @Override public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, PathToSchemasMap pathToSchemas) { {{#if ../arrayOutputJsonPathPiece}} @@ -128,11 +93,6 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCas // bytes, {{else}} -@Override -public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); -} - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -152,11 +112,6 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val {{/eq}} {{#eq this "integer"}} -@Override -public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); -} - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -193,11 +148,6 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{/eq}} {{#eq this "number"}} -@Override -public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); -} - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -273,11 +223,6 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{/eq}} {{#eq this "boolean"}} -@Override -public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); -} - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -296,10 +241,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V {{/eq}} {{/each}} {{else}} -@Override -public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); -} @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -319,11 +260,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } -@Override -public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); -} - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -342,11 +278,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } -@Override -public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); -} - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -381,11 +312,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } -@Override -public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); -} - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -416,11 +342,6 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return validate(arg.toString(), configuration); } -@Override -public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); -} - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -439,25 +360,6 @@ public FrozenList validate(List arg, SchemaConfiguration configu return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } -@Override -public FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castToAllowedTypes(Map src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, Set> pathSet) { - {{#if mapValueSchema}} - pathSet.add(pathToItem); - LinkedHashMap src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> argFixed = new LinkedHashMap<>(); - for (Map.Entry src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> entry: arg.entrySet()) { - String key = entry.getKey(); - {{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - {{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} fixedVal = ({{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - {{else}} - return castToAllowedMapTypes(arg, pathToItem, pathSet); - {{/if}} -} - @Override public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, PathToSchemasMap pathToSchemas) { {{#if mapOutputJsonPathPiece}} diff --git a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs index 9f34e66e763..cfbbdb79370 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs @@ -28,7 +28,7 @@ import java.util.Map; import java.util.Objects; import java.util.UUID; -public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static AnyTypeJsonSchema instance; protected AnyTypeJsonSchema() { @@ -42,11 +42,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -65,11 +60,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -88,11 +78,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -127,11 +112,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -162,11 +142,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return validate(arg.toString(), configuration); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -185,11 +160,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs index 50ea2ce0d00..9e824d61dc8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs @@ -21,7 +21,7 @@ import java.util.List; import java.util.Objects; import java.util.Set; -public class ListJsonSchema extends JsonSchema implements ListSchemaValidator> { +public class ListJsonSchema extends JsonSchema implements ListSchemaValidator> { private static ListJsonSchema instance; protected ListJsonSchema() { @@ -37,11 +37,6 @@ public class ListJsonSchema extends JsonSchema implements ListSchemaValidator castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -51,7 +46,7 @@ public class ListJsonSchema extends JsonSchema implements ListSchemaValidator validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs index 4b41e580dc4..5ee5ba9bb50 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs @@ -21,7 +21,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -public class MapJsonSchema extends JsonSchema implements MapSchemaValidator> { +public class MapJsonSchema extends JsonSchema implements MapSchemaValidator> { private static MapJsonSchema instance; protected MapJsonSchema() { @@ -37,11 +37,6 @@ public class MapJsonSchema extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -51,7 +46,7 @@ public class MapJsonSchema extends JsonSchema implements MapSchemaValidator validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs index 30a72a3eb86..50a7a9a31f1 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -28,7 +28,7 @@ import java.util.Map; import java.util.LinkedHashMap; import java.util.Objects; -public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static NotAnyTypeJsonSchema instance; protected NotAnyTypeJsonSchema() { @@ -44,10 +44,6 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return instance; } - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; } @@ -64,11 +60,6 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -87,11 +78,6 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -110,11 +96,6 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -133,11 +114,6 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -156,11 +132,6 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index 3a1a9e5c2f2..2700d99216a 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -253,27 +253,27 @@ public abstract class JsonSchema { return pathToSchemas; } - protected String castToAllowedStringTypes(String arg, List pathToItem, Set> pathSet) { + protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Boolean castToAllowedBooleanTypes(Boolean arg, List pathToItem, Set> pathSet) { + protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Number castToAllowedNumberTypes(Number arg, List pathToItem, Set> pathSet) { + protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Void castToAllowedVoidTypes(Void arg, List pathToItem, Set> pathSet) { + protected Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected FrozenList castToAllowedListTypes(List arg, List pathToItem, Set> pathSet) { + protected FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; @@ -287,10 +287,10 @@ public abstract class JsonSchema { return new FrozenList<>(argFixed); } - protected FrozenMap castToAllowedMapTypes(Map arg, List pathToItem, Set> pathSet) { + protected FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: ((Map) arg).entrySet()) { + for (Map.Entry entry: arg.entrySet()) { String key = (String) entry.getKey(); Object val = entry.getValue(); List newPathToItem = new ArrayList<>(pathToItem); @@ -303,43 +303,24 @@ public abstract class JsonSchema { protected Object castToAllowedObjectTypes(Object arg, List pathToItem, Set> pathSet) { if (arg == null) { - return castToAllowedVoidTypes((Void) arg, pathToItem, pathSet); + return castToAllowedTypes((Void) arg, pathToItem, pathSet); } else if (arg instanceof String) { - return castToAllowedStringTypes((String) arg, pathToItem, pathSet); + return castToAllowedTypes((String) arg, pathToItem, pathSet); } else if (arg instanceof Map) { pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: ((Map) arg).entrySet()) { - String key = (String) entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); + return castToAllowedTypes((Map) arg, pathToItem, pathSet); } else if (arg instanceof Boolean) { - return castToAllowedBooleanTypes((Boolean) arg, pathToItem, pathSet); + return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); } else if (arg instanceof Integer) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Long) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Float) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Double) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof List) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: ((List) arg).toArray()) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); + return castToAllowedTypes((List arg, pathToItem, pathSet); } else if (arg instanceof ZonedDateTime) { return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); } else if (arg instanceof LocalDate) { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs index da9ecded454..f6fe37ad93e 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs @@ -7,8 +7,7 @@ import {{{packageName}}}.exceptions.ValidationException; import java.util.List; import java.util.Set; -public interface ListSchemaValidator { - FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet); - OutType getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas); +public interface ListSchemaValidator { + OutType getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs index abe847b3e7c..9ae7b7d65f6 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs @@ -8,8 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -public interface MapSchemaValidator { - FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet); - OutType getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas); +public interface MapSchemaValidator { + OutType getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index 15585d3cb28..ef15e256dcd 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -27,11 +27,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -50,11 +45,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -73,11 +63,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -96,11 +81,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -119,11 +99,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; @@ -142,11 +117,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - @Override public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; From 1325ab9d65a43480b1d1fb1ed70a9f7d27756e11 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 16 Dec 2023 12:26:35 -0800 Subject: [PATCH 03/16] Fixes for any type schemas --- .../client/schemas/AnyTypeJsonSchema.java | 8 ++++---- .../client/schemas/MapJsonSchema.java | 4 ++-- .../client/schemas/NotAnyTypeJsonSchema.java | 11 ++++------- .../schemas/validation/BooleanSchemaValidator.java | 1 - .../client/schemas/validation/JsonSchema.java | 13 ++++++------- .../schemas/validation/NullSchemaValidator.java | 1 - .../schemas/validation/NumberSchemaValidator.java | 1 - .../schemas/validation/StringSchemaValidator.java | 1 - .../schemas/validation/UnsetAnyTypeJsonSchema.java | 10 +++++----- .../java/packagename/schemas/AnyTypeJsonSchema.hbs | 8 ++++---- .../main/java/packagename/schemas/MapJsonSchema.hbs | 4 ++-- .../packagename/schemas/NotAnyTypeJsonSchema.hbs | 11 ++++------- .../schemas/validation/BooleanSchemaValidator.hbs | 1 - .../packagename/schemas/validation/JsonSchema.hbs | 13 ++++++------- .../schemas/validation/NullSchemaValidator.hbs | 1 - .../schemas/validation/NumberSchemaValidator.hbs | 1 - .../schemas/validation/StringSchemaValidator.hbs | 1 - .../schemas/validation/UnsetAnyTypeJsonSchema.hbs | 10 +++++----- 18 files changed, 42 insertions(+), 58 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index fc5289c9aa3..b21cfeb0e5c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -143,8 +143,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -161,8 +161,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index d1226e1a9aa..cfff6d78b7d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -38,8 +38,8 @@ public static MapJsonSchema getInstance() { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index cb25bae4316..03784227ca2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -8,8 +8,6 @@ import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.KeywordEntry; -import org.openapijsonschematools.client.schemas.validation.NotValidator; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; @@ -25,7 +23,6 @@ import java.util.LinkedHashSet; import java.util.Set; import java.util.Map; -import java.util.LinkedHashMap; import java.util.Objects; public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { @@ -115,8 +112,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -133,8 +130,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java index 5df6d43e44b..334dde1536f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java @@ -8,7 +8,6 @@ import java.util.Set; public interface BooleanSchemaValidator { - boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet); boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas); boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index 391f9ea77c1..177b9b98d90 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -223,7 +223,6 @@ public static PathToSchemasMap validate( ValidationMetadata validationMetadata ) throws ValidationException { LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); - Object extra = null; PathToSchemasMap pathToSchemas = new PathToSchemasMap(); LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; if (thisKeywordToValidator != null) { @@ -277,7 +276,7 @@ protected FrozenList castToAllowedTypes(List arg, List pathTo pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; - for (Object item: ((List) arg).toArray()) { + for (Object item: arg) { List newPathToItem = new ArrayList<>(pathToItem); newPathToItem.add(i); Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); @@ -303,7 +302,7 @@ protected FrozenMap castToAllowedTypes(Map arg, List pathT protected Object castToAllowedObjectTypes(Object arg, List pathToItem, Set> pathSet) { if (arg == null) { - return castToAllowedTypes((Void) arg, pathToItem, pathSet); + return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { return castToAllowedTypes((String) arg, pathToItem, pathSet); } else if (arg instanceof Map) { @@ -320,13 +319,13 @@ protected Object castToAllowedObjectTypes(Object arg, List pathToItem, S } else if (arg instanceof Double) { return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof List) { - return castToAllowedTypes((List arg, pathToItem, pathSet); + return castToAllowedTypes((List) arg, pathToItem, pathSet); } else if (arg instanceof ZonedDateTime) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else if (arg instanceof LocalDate) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else if (arg instanceof UUID) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else { Class argClass = arg.getClass(); throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index ca3d21ff136..cc5036004d9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -8,7 +8,6 @@ import java.util.Set; public interface NullSchemaValidator { - Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet); Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas); Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java index eaec6888a67..71df32c18da 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java @@ -8,7 +8,6 @@ import java.util.Set; public interface NumberSchemaValidator { - Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet); Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas); Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java index 752804304c1..0466ad5e12c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java @@ -8,7 +8,6 @@ import java.util.Set; public interface StringSchemaValidator { - String castToAllowedTypes(String arg, List pathToItem, Set> pathSet); String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas); String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index aa07ed96ac9..bb75b95544f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -13,7 +13,7 @@ import java.util.Map; import java.util.Objects; -public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static UnsetAnyTypeJsonSchema instance; protected UnsetAnyTypeJsonSchema() { @@ -100,8 +100,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -118,8 +118,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs index cfbbdb79370..28747ff90c6 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs @@ -143,8 +143,8 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -161,8 +161,8 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs index 5ee5ba9bb50..338c59575a6 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs @@ -38,8 +38,8 @@ public class MapJsonSchema extends JsonSchema implements MapSchemaValidator getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs index 50a7a9a31f1..b44b9ea9939 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -8,8 +8,6 @@ import {{{packageName}}}.schemas.validation.FrozenList; import {{{packageName}}}.schemas.validation.FrozenMap; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; -import {{{packageName}}}.schemas.validation.KeywordEntry; -import {{{packageName}}}.schemas.validation.NotValidator; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.NullSchemaValidator; import {{{packageName}}}.schemas.validation.BooleanSchemaValidator; @@ -25,7 +23,6 @@ import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.Set; import java.util.Map; -import java.util.LinkedHashMap; import java.util.Objects; public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { @@ -115,8 +112,8 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -133,8 +130,8 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs index 30e2d55c7b2..b199c13df24 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs @@ -8,7 +8,6 @@ import java.util.List; import java.util.Set; public interface BooleanSchemaValidator { - boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet); boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas); boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index 2700d99216a..d18f0c5c1da 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -223,7 +223,6 @@ public abstract class JsonSchema { ValidationMetadata validationMetadata ) throws ValidationException { LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); - Object extra = null; PathToSchemasMap pathToSchemas = new PathToSchemasMap(); LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; if (thisKeywordToValidator != null) { @@ -277,7 +276,7 @@ public abstract class JsonSchema { pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; - for (Object item: ((List) arg).toArray()) { + for (Object item: arg) { List newPathToItem = new ArrayList<>(pathToItem); newPathToItem.add(i); Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); @@ -303,7 +302,7 @@ public abstract class JsonSchema { protected Object castToAllowedObjectTypes(Object arg, List pathToItem, Set> pathSet) { if (arg == null) { - return castToAllowedTypes((Void) arg, pathToItem, pathSet); + return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { return castToAllowedTypes((String) arg, pathToItem, pathSet); } else if (arg instanceof Map) { @@ -320,13 +319,13 @@ public abstract class JsonSchema { } else if (arg instanceof Double) { return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof List) { - return castToAllowedTypes((List arg, pathToItem, pathSet); + return castToAllowedTypes((List) arg, pathToItem, pathSet); } else if (arg instanceof ZonedDateTime) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else if (arg instanceof LocalDate) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else if (arg instanceof UUID) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else { Class argClass = arg.getClass(); throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs index d27782e3eff..722da16fa2c 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs @@ -8,7 +8,6 @@ import java.util.List; import java.util.Set; public interface NullSchemaValidator { - Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet); Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas); Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs index d4eccac91f1..855144d4981 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs @@ -8,7 +8,6 @@ import java.util.List; import java.util.Set; public interface NumberSchemaValidator { - Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet); Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas); Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs index 580976647bc..4298f89f728 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs @@ -8,7 +8,6 @@ import java.util.List; import java.util.Set; public interface StringSchemaValidator { - String castToAllowedTypes(String arg, List pathToItem, Set> pathSet); String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas); String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index ef15e256dcd..4780ffd55e4 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -13,7 +13,7 @@ import java.util.Set; import java.util.Map; import java.util.Objects; -public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static UnsetAnyTypeJsonSchema instance; protected UnsetAnyTypeJsonSchema() { @@ -100,8 +100,8 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -118,8 +118,8 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override From 1b4c9cb208790323b70624b2c5bc2cce012d45a7 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 16 Dec 2023 12:40:26 -0800 Subject: [PATCH 04/16] Fixes more template errors --- ...rtiesAllowsASchemaWhichShouldValidate.java | 137 ------------------ ...ditionalpropertiesAreAllowedByDefault.java | 2 +- ...lpropertiesShouldNotLookInApplicators.java | 4 +- .../client/components/schemas/Allof.java | 6 +- .../schemas/AllofCombinedWithAnyofOneof.java | 8 +- .../components/schemas/AllofSimpleTypes.java | 6 +- .../schemas/AllofWithBaseSchema.java | 6 +- .../schemas/AllofWithOneEmptySchema.java | 2 +- .../schemas/AllofWithTheFirstEmptySchema.java | 2 +- .../schemas/AllofWithTheLastEmptySchema.java | 2 +- .../schemas/AllofWithTwoEmptySchemas.java | 2 +- .../client/components/schemas/Anyof.java | 4 +- .../components/schemas/AnyofComplexTypes.java | 6 +- .../schemas/AnyofWithBaseSchema.java | 4 +- .../schemas/AnyofWithOneEmptySchema.java | 2 +- .../schemas/ArrayTypeMatchesArrays.java | 2 +- .../client/components/schemas/ByInt.java | 2 +- .../client/components/schemas/ByNumber.java | 2 +- .../components/schemas/BySmallNumber.java | 2 +- .../components/schemas/DateTimeFormat.java | 2 +- .../components/schemas/EmailFormat.java | 2 +- .../components/schemas/ForbiddenProperty.java | 2 +- .../components/schemas/HostnameFormat.java | 2 +- .../schemas/InvalidStringValueForDefault.java | 2 +- .../client/components/schemas/Ipv4Format.java | 2 +- .../client/components/schemas/Ipv6Format.java | 2 +- .../components/schemas/JsonPointerFormat.java | 2 +- .../components/schemas/MaximumValidation.java | 2 +- .../MaximumValidationWithUnsignedInteger.java | 2 +- .../schemas/MaxitemsValidation.java | 2 +- .../schemas/MaxlengthValidation.java | 2 +- .../Maxproperties0MeansTheObjectIsEmpty.java | 2 +- .../schemas/MaxpropertiesValidation.java | 2 +- .../components/schemas/MinimumValidation.java | 2 +- .../MinimumValidationWithSignedInteger.java | 2 +- .../schemas/MinitemsValidation.java | 2 +- .../schemas/MinlengthValidation.java | 2 +- .../schemas/MinpropertiesValidation.java | 2 +- ...NestedAllofToCheckValidationSemantics.java | 4 +- ...NestedAnyofToCheckValidationSemantics.java | 4 +- .../components/schemas/NestedItems.java | 8 +- ...NestedOneofToCheckValidationSemantics.java | 4 +- .../client/components/schemas/Not.java | 2 +- .../schemas/NotMoreComplexSchema.java | 2 +- .../schemas/ObjectPropertiesValidation.java | 2 +- .../client/components/schemas/Oneof.java | 4 +- .../components/schemas/OneofComplexTypes.java | 6 +- .../schemas/OneofWithBaseSchema.java | 4 +- .../schemas/OneofWithEmptySchema.java | 2 +- .../components/schemas/OneofWithRequired.java | 4 +- .../schemas/PatternIsNotAnchored.java | 2 +- .../components/schemas/PatternValidation.java | 2 +- .../PropertiesWithEscapedCharacters.java | 2 +- .../PropertyNamedRefThatIsNotAReference.java | 2 +- .../client/components/schemas/RefInAllof.java | 2 +- .../client/components/schemas/RefInAnyof.java | 2 +- .../client/components/schemas/RefInItems.java | 2 +- .../client/components/schemas/RefInNot.java | 2 +- .../client/components/schemas/RefInOneof.java | 2 +- .../components/schemas/RefInProperty.java | 2 +- .../schemas/RequiredDefaultValidation.java | 2 +- .../schemas/RequiredValidation.java | 2 +- .../schemas/RequiredWithEmptyArray.java | 2 +- .../RequiredWithEscapedCharacters.java | 2 +- .../schemas/UniqueitemsFalseValidation.java | 2 +- .../schemas/UniqueitemsValidation.java | 2 +- .../client/components/schemas/UriFormat.java | 2 +- .../schemas/UriReferenceFormat.java | 2 +- .../components/schemas/UriTemplateFormat.java | 2 +- .../_Schema_anytypeOrMultitype.hbs | 4 +- .../schemas/SchemaClass/_Schema_list.hbs | 2 +- .../SchemaClass/_validate_implementor.hbs | 12 +- 72 files changed, 102 insertions(+), 239 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index 8cc8f7bdaef..e69de29bb2d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -1,137 +0,0 @@ -package org.openapijsonschematools.client.components.schemas; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; -import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; -import org.openapijsonschematools.client.schemas.validation.PropertyEntry; -import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; - -public class AdditionalpropertiesAllowsASchemaWhichShouldValidate { - // nest classes so all schemas and input/output classes can be public - - - public static class AdditionalProperties extends BooleanJsonSchema {} - - - public static class Foo extends AnyTypeJsonSchema {} - - - public static class Bar extends AnyTypeJsonSchema {} - - - public static class AdditionalpropertiesAllowsASchemaWhichShouldValidateMap extends FrozenMap { - AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(FrozenMap m) { - super(m); - } - public static final Set requiredKeys = Set.of(); - public static final Set optionalKeys = Set.of( - "foo", - "bar" - ); - public static AdditionalpropertiesAllowsASchemaWhichShouldValidateMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { - return AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance().validate(arg, configuration); - } - - public Object foo() { - String key = "foo"; - throwIfKeyNotPresent(key); - return get(key); - } - - public Object bar() { - String key = "bar"; - throwIfKeyNotPresent(key); - return get(key); - } - - public boolean getAdditionalProperty(String name) { - throwIfKeyNotPresent(name); - return (boolean) get(name); - } - } - public static class AdditionalpropertiesAllowsASchemaWhichShouldValidateMapInput { - // optionalProperties + additionalProperties - } - - - public static class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 extends JsonSchema implements MapSchemaValidator { - /* - NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - - Do not edit the class manually. - */ - private static AdditionalpropertiesAllowsASchemaWhichShouldValidate1 instance; - - protected AdditionalpropertiesAllowsASchemaWhichShouldValidate1() { - super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) - .properties(Map.ofEntries( - new PropertyEntry("foo", Foo.class), - new PropertyEntry("bar", Bar.class) - )) - .additionalProperties(AdditionalProperties.class) - ); - } - - public static AdditionalpropertiesAllowsASchemaWhichShouldValidate1 getInstance() { - if (instance == null) { - instance = new AdditionalpropertiesAllowsASchemaWhichShouldValidate1(); - } - return instance; - } - - public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); - List propertyPathToItem = new ArrayList<>(pathToItem); - propertyPathToItem.add(propertyName); - Object value = entry.getValue(); - JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - properties.put(propertyName, castValue); - } - FrozenMap castProperties = new FrozenMap<>(properties); - return new AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(castProperties); - } - - @Override - public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { - Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); - SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - - @Override - public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } - throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); - } - } - -} diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index c4669f2b2ff..2709cd2a805 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -75,7 +75,7 @@ public static class AdditionalpropertiesAreAllowedByDefaultMapInput { } - public static class AdditionalpropertiesAreAllowedByDefault1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class AdditionalpropertiesAreAllowedByDefault1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 0957d2a7ec2..f1891fa85bc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -70,7 +70,7 @@ public static class Schema0MapInput { } - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema0 instance; protected Schema0() { @@ -277,7 +277,7 @@ public static class AdditionalpropertiesShouldNotLookInApplicatorsMapInput { } - public static class AdditionalpropertiesShouldNotLookInApplicators1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class AdditionalpropertiesShouldNotLookInApplicators1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index 5f390e65a47..b29559656be 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -64,7 +64,7 @@ public static class Schema0MapInput { } - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema0 instance; protected Schema0() { @@ -284,7 +284,7 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema1 instance; protected Schema1() { @@ -474,7 +474,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Allof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Allof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index 2e2ced5444f..41ee4ec9ed8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -32,7 +32,7 @@ public class AllofCombinedWithAnyofOneof { // nest classes so all schemas and input/output classes can be public - public static class Schema02 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema02 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema02 instance; protected Schema02() { @@ -206,7 +206,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Schema01 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema01 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema01 instance; protected Schema01() { @@ -380,7 +380,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema0 instance; protected Schema0() { @@ -554,7 +554,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class AllofCombinedWithAnyofOneof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AllofCombinedWithAnyofOneof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index 9c20744a41e..02983246e35 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -31,7 +31,7 @@ public class AllofSimpleTypes { // nest classes so all schemas and input/output classes can be public - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema0 instance; protected Schema0() { @@ -205,7 +205,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema1 instance; protected Schema1() { @@ -379,7 +379,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class AllofSimpleTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AllofSimpleTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index a16a222b357..4446093a579 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -65,7 +65,7 @@ public static class Schema0MapInput { } - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema0 instance; protected Schema0() { @@ -285,7 +285,7 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema1 instance; protected Schema1() { @@ -505,7 +505,7 @@ public static class AllofWithBaseSchemaMapInput { } - public static class AllofWithBaseSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class AllofWithBaseSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index f37ee92fad0..39ed1b767d7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -35,7 +35,7 @@ public class AllofWithOneEmptySchema { public static class Schema0 extends AnyTypeJsonSchema {} - public static class AllofWithOneEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AllofWithOneEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 9ef49602c3a..9f627892917 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -39,7 +39,7 @@ public static class Schema0 extends AnyTypeJsonSchema {} public static class Schema1 extends NumberJsonSchema {} - public static class AllofWithTheFirstEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AllofWithTheFirstEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 8c3d5e6b3d5..e6b800646a0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -39,7 +39,7 @@ public static class Schema0 extends NumberJsonSchema {} public static class Schema1 extends AnyTypeJsonSchema {} - public static class AllofWithTheLastEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AllofWithTheLastEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index 323b117d6a3..19d77484949 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -38,7 +38,7 @@ public static class Schema0 extends AnyTypeJsonSchema {} public static class Schema1 extends AnyTypeJsonSchema {} - public static class AllofWithTwoEmptySchemas1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AllofWithTwoEmptySchemas1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index aa66ed30c85..83e7a546bce 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -35,7 +35,7 @@ public class Anyof { public static class Schema0 extends IntJsonSchema {} - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema1 instance; protected Schema1() { @@ -209,7 +209,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Anyof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Anyof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index 03f222511e7..a00e8888cbd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -64,7 +64,7 @@ public static class Schema0MapInput { } - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema0 instance; protected Schema0() { @@ -284,7 +284,7 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema1 instance; protected Schema1() { @@ -474,7 +474,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class AnyofComplexTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AnyofComplexTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index 4ee22284dba..72e4f4f76f9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -31,7 +31,7 @@ public class AnyofWithBaseSchema { // nest classes so all schemas and input/output classes can be public - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema0 instance; protected Schema0() { @@ -205,7 +205,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema1 instance; protected Schema1() { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index d9354e597b1..04231d50f1b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -39,7 +39,7 @@ public static class Schema0 extends NumberJsonSchema {} public static class Schema1 extends AnyTypeJsonSchema {} - public static class AnyofWithOneEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AnyofWithOneEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 177ef8157fd..58ab2a65a95 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -40,7 +40,7 @@ public static class ArrayTypeMatchesArraysListInput { } - public static class ArrayTypeMatchesArrays1 extends JsonSchema implements ListSchemaValidator { + public static class ArrayTypeMatchesArrays1 extends JsonSchema implements ListSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index da90a25635d..fcf2576e048 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -32,7 +32,7 @@ public class ByInt { // nest classes so all schemas and input/output classes can be public - public static class ByInt1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ByInt1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index 69661ced328..ec79b153ba9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -32,7 +32,7 @@ public class ByNumber { // nest classes so all schemas and input/output classes can be public - public static class ByNumber1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ByNumber1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index 4a01b764df7..b5326d80e68 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -32,7 +32,7 @@ public class BySmallNumber { // nest classes so all schemas and input/output classes can be public - public static class BySmallNumber1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class BySmallNumber1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index 36a555f5ecb..5b3997b666c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -31,7 +31,7 @@ public class DateTimeFormat { // nest classes so all schemas and input/output classes can be public - public static class DateTimeFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class DateTimeFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index 020f39f4650..07aec10af24 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -31,7 +31,7 @@ public class EmailFormat { // nest classes so all schemas and input/output classes can be public - public static class EmailFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class EmailFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 52370d0112e..febb57117b1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -67,7 +67,7 @@ public static class ForbiddenPropertyMapInput { } - public static class ForbiddenProperty1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class ForbiddenProperty1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index 4c27f4ef621..dde1f532cad 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -31,7 +31,7 @@ public class HostnameFormat { // nest classes so all schemas and input/output classes can be public - public static class HostnameFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class HostnameFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index 96939e0c7f7..7864a0f7258 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -105,7 +105,7 @@ public static class InvalidStringValueForDefaultMapInput { } - public static class InvalidStringValueForDefault1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class InvalidStringValueForDefault1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index 8527cd14526..ed6cab5c2cb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -31,7 +31,7 @@ public class Ipv4Format { // nest classes so all schemas and input/output classes can be public - public static class Ipv4Format1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Ipv4Format1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index 54f09df5690..149c9e1173f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -31,7 +31,7 @@ public class Ipv6Format { // nest classes so all schemas and input/output classes can be public - public static class Ipv6Format1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Ipv6Format1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index 1fcac7b6ca6..0c433e28a0b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -31,7 +31,7 @@ public class JsonPointerFormat { // nest classes so all schemas and input/output classes can be public - public static class JsonPointerFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class JsonPointerFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index 1fb70ecbe1c..d41d5f9948b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -31,7 +31,7 @@ public class MaximumValidation { // nest classes so all schemas and input/output classes can be public - public static class MaximumValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MaximumValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index d7360c8eec8..b30170bcc99 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -31,7 +31,7 @@ public class MaximumValidationWithUnsignedInteger { // nest classes so all schemas and input/output classes can be public - public static class MaximumValidationWithUnsignedInteger1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MaximumValidationWithUnsignedInteger1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index 13e4dc176ad..4442d234f25 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -31,7 +31,7 @@ public class MaxitemsValidation { // nest classes so all schemas and input/output classes can be public - public static class MaxitemsValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MaxitemsValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 4ae4d5a2fe7..e33984b762a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -31,7 +31,7 @@ public class MaxlengthValidation { // nest classes so all schemas and input/output classes can be public - public static class MaxlengthValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MaxlengthValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index ace8a0e443a..7b0602f89a8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -31,7 +31,7 @@ public class Maxproperties0MeansTheObjectIsEmpty { // nest classes so all schemas and input/output classes can be public - public static class Maxproperties0MeansTheObjectIsEmpty1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Maxproperties0MeansTheObjectIsEmpty1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 2f868fc71b8..9f41cb3700f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -31,7 +31,7 @@ public class MaxpropertiesValidation { // nest classes so all schemas and input/output classes can be public - public static class MaxpropertiesValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MaxpropertiesValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index a361914b7b9..6b548cbf295 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -31,7 +31,7 @@ public class MinimumValidation { // nest classes so all schemas and input/output classes can be public - public static class MinimumValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MinimumValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 189d4231e21..4c3106d8924 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -31,7 +31,7 @@ public class MinimumValidationWithSignedInteger { // nest classes so all schemas and input/output classes can be public - public static class MinimumValidationWithSignedInteger1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MinimumValidationWithSignedInteger1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 7f8c63dba7b..2266cf6d1f4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -31,7 +31,7 @@ public class MinitemsValidation { // nest classes so all schemas and input/output classes can be public - public static class MinitemsValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MinitemsValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 28747e379c1..450039c8756 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -31,7 +31,7 @@ public class MinlengthValidation { // nest classes so all schemas and input/output classes can be public - public static class MinlengthValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MinlengthValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 19bbef069c5..78c16f755f0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -31,7 +31,7 @@ public class MinpropertiesValidation { // nest classes so all schemas and input/output classes can be public - public static class MinpropertiesValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class MinpropertiesValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index be4977c1949..5a9fce8e955 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -35,7 +35,7 @@ public class NestedAllofToCheckValidationSemantics { public static class Schema01 extends NullJsonSchema {} - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema0 instance; protected Schema0() { @@ -211,7 +211,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class NestedAllofToCheckValidationSemantics1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class NestedAllofToCheckValidationSemantics1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index 0733450e903..c477cd34e7b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -35,7 +35,7 @@ public class NestedAnyofToCheckValidationSemantics { public static class Schema01 extends NullJsonSchema {} - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema0 instance; protected Schema0() { @@ -211,7 +211,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class NestedAnyofToCheckValidationSemantics1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class NestedAnyofToCheckValidationSemantics1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index 3bf7b1c18e8..fbfb1916b89 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -40,7 +40,7 @@ public static class ItemsListInput { } - public static class Items2 extends JsonSchema implements ListSchemaValidator { + public static class Items2 extends JsonSchema implements ListSchemaValidator { private static Items2 instance; protected Items2() { @@ -108,7 +108,7 @@ public static class ItemsListInput1 { } - public static class Items1 extends JsonSchema implements ListSchemaValidator, FrozenList, ItemsList1> { + public static class Items1 extends JsonSchema implements ListSchemaValidator, ItemsList1> { private static Items1 instance; protected Items1() { @@ -176,7 +176,7 @@ public static class ItemsListInput2 { } - public static class Items extends JsonSchema implements ListSchemaValidator>, FrozenList>, ItemsList2> { + public static class Items extends JsonSchema implements ListSchemaValidator>, ItemsList2> { private static Items instance; protected Items() { @@ -244,7 +244,7 @@ public static class NestedItemsListInput { } - public static class NestedItems1 extends JsonSchema implements ListSchemaValidator>>, FrozenList>>, NestedItemsList> { + public static class NestedItems1 extends JsonSchema implements ListSchemaValidator>>, NestedItemsList> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index 053bd9d1aaa..cde7033e9f8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -35,7 +35,7 @@ public class NestedOneofToCheckValidationSemantics { public static class Schema01 extends NullJsonSchema {} - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema0 instance; protected Schema0() { @@ -211,7 +211,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class NestedOneofToCheckValidationSemantics1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class NestedOneofToCheckValidationSemantics1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 4b976617a77..0f78f84ec93 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -35,7 +35,7 @@ public class Not { public static class Not2 extends IntJsonSchema {} - public static class Not1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Not1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 871993170fc..a361200f880 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -122,7 +122,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } - public static class NotMoreComplexSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class NotMoreComplexSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index a1899e1c3e6..79b60267c8c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -76,7 +76,7 @@ public static class ObjectPropertiesValidationMapInput { } - public static class ObjectPropertiesValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class ObjectPropertiesValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 45344604873..745073c2260 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -35,7 +35,7 @@ public class Oneof { public static class Schema0 extends IntJsonSchema {} - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema1 instance; protected Schema1() { @@ -209,7 +209,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Oneof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Oneof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 6798c69e45f..2f1d16d5970 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -64,7 +64,7 @@ public static class Schema0MapInput { } - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema0 instance; protected Schema0() { @@ -284,7 +284,7 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema1 instance; protected Schema1() { @@ -474,7 +474,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class OneofComplexTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class OneofComplexTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index 623175d1a89..84a29839b62 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -31,7 +31,7 @@ public class OneofWithBaseSchema { // nest classes so all schemas and input/output classes can be public - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema0 instance; protected Schema0() { @@ -205,7 +205,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema1 instance; protected Schema1() { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 334bc101e2d..03cb77324c1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -39,7 +39,7 @@ public static class Schema0 extends NumberJsonSchema {} public static class Schema1 extends AnyTypeJsonSchema {} - public static class OneofWithEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class OneofWithEmptySchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index a4d1cf9bf4f..9d439ee0f8b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -63,7 +63,7 @@ public static class Schema0MapInput { } - public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema0 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema0 instance; protected Schema0() { @@ -283,7 +283,7 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { private static Schema1 instance; protected Schema1() { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 3dc8a0103f6..f26f8bac15e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -32,7 +32,7 @@ public class PatternIsNotAnchored { // nest classes so all schemas and input/output classes can be public - public static class PatternIsNotAnchored1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class PatternIsNotAnchored1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 43861398dd2..19d0837a850 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -32,7 +32,7 @@ public class PatternValidation { // nest classes so all schemas and input/output classes can be public - public static class PatternValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class PatternValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index cc67b0ac43e..b0c33f7066c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -79,7 +79,7 @@ public static class PropertiesWithEscapedCharactersMapInput { } - public static class PropertiesWithEscapedCharacters1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class PropertiesWithEscapedCharacters1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 4f672ab448b..f5697483c9c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -59,7 +59,7 @@ public static class PropertyNamedRefThatIsNotAReferenceMapInput { } - public static class PropertyNamedRefThatIsNotAReference1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class PropertyNamedRefThatIsNotAReference1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index e290c123ac1..6287041dc77 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -31,7 +31,7 @@ public class RefInAllof { // nest classes so all schemas and input/output classes can be public - public static class RefInAllof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class RefInAllof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index 5de912427e1..cb0378d1840 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -31,7 +31,7 @@ public class RefInAnyof { // nest classes so all schemas and input/output classes can be public - public static class RefInAnyof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class RefInAnyof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index e85c86b6074..c5d0403d7be 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -36,7 +36,7 @@ public static class RefInItemsListInput { } - public static class RefInItems1 extends JsonSchema implements ListSchemaValidator { + public static class RefInItems1 extends JsonSchema implements ListSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index cad9c2faeef..e6cf2496c8c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -31,7 +31,7 @@ public class RefInNot { // nest classes so all schemas and input/output classes can be public - public static class RefInNot1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class RefInNot1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index d214130dc6a..70cb22fcd1d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -31,7 +31,7 @@ public class RefInOneof { // nest classes so all schemas and input/output classes can be public - public static class RefInOneof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class RefInOneof1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index 30247a2f6c6..692bc8b7bda 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -61,7 +61,7 @@ public static class RefInPropertyMapInput { } - public static class RefInProperty1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class RefInProperty1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 67f03425588..d3f3d0ea868 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -65,7 +65,7 @@ public static class RequiredDefaultValidationMapInput { } - public static class RequiredDefaultValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class RequiredDefaultValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index deb5d1a7ecf..6ef09c20f92 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -74,7 +74,7 @@ public static class RequiredValidationMapInput { } - public static class RequiredValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class RequiredValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index fd6e3b687d0..7d17288c635 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -65,7 +65,7 @@ public static class RequiredWithEmptyArrayMapInput { } - public static class RequiredWithEmptyArray1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class RequiredWithEmptyArray1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 61216ddd29b..24e697f30fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -59,7 +59,7 @@ public static class RequiredWithEscapedCharactersMapInput { } - public static class RequiredWithEscapedCharacters1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class RequiredWithEscapedCharacters1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index 8a96a5d976c..67118aec772 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -31,7 +31,7 @@ public class UniqueitemsFalseValidation { // nest classes so all schemas and input/output classes can be public - public static class UniqueitemsFalseValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class UniqueitemsFalseValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index c102ebae6af..695b1397acd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -31,7 +31,7 @@ public class UniqueitemsValidation { // nest classes so all schemas and input/output classes can be public - public static class UniqueitemsValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class UniqueitemsValidation1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index e2d2f6143dc..7536544bee7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -31,7 +31,7 @@ public class UriFormat { // nest classes so all schemas and input/output classes can be public - public static class UriFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class UriFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index f8e109944b5..9beabff7a0f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -31,7 +31,7 @@ public class UriReferenceFormat { // nest classes so all schemas and input/output classes can be public - public static class UriReferenceFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class UriReferenceFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index b4d54e76934..6b07aff6862 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -31,7 +31,7 @@ public class UriTemplateFormat { // nest classes so all schemas and input/output classes can be public - public static class UriTemplateFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class UriTemplateFormat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs index 4a998b07e17..1553efb27c0 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs @@ -1,9 +1,9 @@ {{#if types}} -public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements {{#each types}}{{#eq this "null"}}NullSchemaValidator{{else}}{{#eq this "boolean"}}BooleanSchemaValidator{{else}}{{#or (eq this "number") (eq this "integer")}}NumberSchemaValidator{{else}}{{#eq this "string"}}StringSchemaValidator{{else}}{{#eq this "array"}}ListSchemaValidator<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList{{/if}}>{{else}}{{#eq this "object"}}MapSchemaValidator<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}}>{{/eq}}{{/eq}}{{/eq}}{{/or}}{{/eq}}{{/eq}}{{#unless @last}}, {{/unless}}{{/each}} { +public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements {{#each types}}{{#eq this "null"}}NullSchemaValidator{{else}}{{#eq this "boolean"}}BooleanSchemaValidator{{else}}{{#or (eq this "number") (eq this "integer")}}NumberSchemaValidator{{else}}{{#eq this "string"}}StringSchemaValidator{{else}}{{#eq this "array"}}ListSchemaValidator<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList{{/if}}>{{else}}{{#eq this "object"}}MapSchemaValidator<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}}>{{/eq}}{{/eq}}{{/eq}}{{/or}}{{/eq}}{{/eq}}{{#unless @last}}, {{/unless}}{{/each}} { {{else}} -public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList{{/if}}>, MapSchemaValidator<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}}> { +public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList{{/if}}>, MapSchemaValidator<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}, {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}}> { {{/if}} {{#if componentModule}} /* diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_list.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_list.hbs index 2aedc744be5..1ce842df3d0 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_list.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_list.hbs @@ -1,6 +1,6 @@ -public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements ListSchemaValidator<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}, {{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}, {{arrayOutputJsonPathPiece.camelCase}}> { +public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements ListSchemaValidator<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}, {{arrayOutputJsonPathPiece.camelCase}}> { {{#if componentModule}} /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index df87c35faf4..e32ff0d1384 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -21,9 +21,9 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat {{#eq this "object"}} {{#if ../mapOutputJsonPathPiece}} -public {{../mapOutputJsonPathPiece.camelCase}} getNewInstance(FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public {{../mapOutputJsonPathPiece.camelCase}} getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> properties = new LinkedHashMap<>(); - for(Map.Entry src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); @@ -37,7 +37,7 @@ public {{../mapOutputJsonPathPiece.camelCase}} getNewInstance(FrozenMap<{{#with } {{else}} @Override -public FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> getNewInstance(FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; } {{/if}} @@ -57,7 +57,7 @@ public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.camelCase}}{ {{#eq this "array"}} @Override -public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { {{#if ../arrayOutputJsonPathPiece}} ArrayList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> items = new ArrayList<>(); int i = 0; @@ -343,7 +343,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override -public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; } @@ -361,7 +361,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override -public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { {{#if mapOutputJsonPathPiece}} LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> properties = new LinkedHashMap<>(); for(Map.Entry src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> entry: arg.entrySet()) { From d761ae0ad1c59976d009e4d7e630b1dac21728ed Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 16 Dec 2023 12:56:09 -0800 Subject: [PATCH 05/16] Removes unneeded casting methods --- ...rtiesAllowsASchemaWhichShouldValidate.java | 137 ++++++++++++++++++ ...ditionalpropertiesAreAllowedByDefault.java | 6 +- .../AdditionalpropertiesCanExistByItself.java | 4 +- ...lpropertiesShouldNotLookInApplicators.java | 12 +- .../client/components/schemas/Allof.java | 20 +-- .../schemas/AllofCombinedWithAnyofOneof.java | 32 ++-- .../components/schemas/AllofSimpleTypes.java | 24 +-- .../schemas/AllofWithBaseSchema.java | 18 +-- .../schemas/AllofWithOneEmptySchema.java | 8 +- .../schemas/AllofWithTheFirstEmptySchema.java | 8 +- .../schemas/AllofWithTheLastEmptySchema.java | 8 +- .../schemas/AllofWithTwoEmptySchemas.java | 8 +- .../client/components/schemas/Anyof.java | 16 +- .../components/schemas/AnyofComplexTypes.java | 20 +-- .../schemas/AnyofWithBaseSchema.java | 16 +- .../schemas/AnyofWithOneEmptySchema.java | 8 +- .../schemas/ArrayTypeMatchesArrays.java | 2 +- .../client/components/schemas/ByInt.java | 8 +- .../client/components/schemas/ByNumber.java | 8 +- .../components/schemas/BySmallNumber.java | 8 +- .../components/schemas/DateTimeFormat.java | 8 +- .../components/schemas/EmailFormat.java | 8 +- .../components/schemas/EnumsInProperties.java | 4 +- .../components/schemas/ForbiddenProperty.java | 6 +- .../components/schemas/HostnameFormat.java | 8 +- .../schemas/InvalidStringValueForDefault.java | 6 +- .../client/components/schemas/Ipv4Format.java | 8 +- .../client/components/schemas/Ipv6Format.java | 8 +- .../components/schemas/JsonPointerFormat.java | 8 +- .../components/schemas/MaximumValidation.java | 8 +- .../MaximumValidationWithUnsignedInteger.java | 8 +- .../schemas/MaxitemsValidation.java | 8 +- .../schemas/MaxlengthValidation.java | 8 +- .../Maxproperties0MeansTheObjectIsEmpty.java | 8 +- .../schemas/MaxpropertiesValidation.java | 8 +- .../components/schemas/MinimumValidation.java | 8 +- .../MinimumValidationWithSignedInteger.java | 8 +- .../schemas/MinitemsValidation.java | 8 +- .../schemas/MinlengthValidation.java | 8 +- .../schemas/MinpropertiesValidation.java | 8 +- ...NestedAllofToCheckValidationSemantics.java | 16 +- ...NestedAnyofToCheckValidationSemantics.java | 16 +- .../components/schemas/NestedItems.java | 8 +- ...NestedOneofToCheckValidationSemantics.java | 16 +- .../client/components/schemas/Not.java | 8 +- .../schemas/NotMoreComplexSchema.java | 12 +- .../schemas/ObjectPropertiesValidation.java | 6 +- .../client/components/schemas/Oneof.java | 16 +- .../components/schemas/OneofComplexTypes.java | 20 +-- .../schemas/OneofWithBaseSchema.java | 16 +- .../schemas/OneofWithEmptySchema.java | 8 +- .../components/schemas/OneofWithRequired.java | 16 +- .../schemas/PatternIsNotAnchored.java | 8 +- .../components/schemas/PatternValidation.java | 8 +- .../PropertiesWithEscapedCharacters.java | 6 +- .../PropertyNamedRefThatIsNotAReference.java | 6 +- .../schemas/RefInAdditionalproperties.java | 4 +- .../client/components/schemas/RefInAllof.java | 8 +- .../client/components/schemas/RefInAnyof.java | 8 +- .../client/components/schemas/RefInItems.java | 2 +- .../client/components/schemas/RefInNot.java | 8 +- .../client/components/schemas/RefInOneof.java | 8 +- .../components/schemas/RefInProperty.java | 6 +- .../schemas/RequiredDefaultValidation.java | 6 +- .../schemas/RequiredValidation.java | 6 +- .../schemas/RequiredWithEmptyArray.java | 6 +- .../RequiredWithEscapedCharacters.java | 6 +- ...esNotDoAnythingIfThePropertyIsMissing.java | 4 +- .../schemas/UniqueitemsFalseValidation.java | 8 +- .../schemas/UniqueitemsValidation.java | 8 +- .../client/components/schemas/UriFormat.java | 8 +- .../schemas/UriReferenceFormat.java | 8 +- .../components/schemas/UriTemplateFormat.java | 8 +- .../client/schemas/DoubleJsonSchema.java | 5 - .../client/schemas/FloatJsonSchema.java | 5 - .../client/schemas/Int32JsonSchema.java | 5 - .../client/schemas/Int64JsonSchema.java | 5 - .../client/schemas/IntJsonSchema.java | 5 - .../client/schemas/NumberJsonSchema.java | 5 - .../SchemaClass/_validate_implementor.hbs | 8 +- .../packagename/schemas/DoubleJsonSchema.hbs | 5 - .../packagename/schemas/FloatJsonSchema.hbs | 5 - .../packagename/schemas/Int32JsonSchema.hbs | 5 - .../packagename/schemas/Int64JsonSchema.hbs | 5 - .../packagename/schemas/IntJsonSchema.hbs | 5 - .../packagename/schemas/NumberJsonSchema.hbs | 5 - 86 files changed, 483 insertions(+), 406 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index e69de29bb2d..5580aa5f156 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -0,0 +1,137 @@ +package org.openapijsonschematools.client.components.schemas; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; +import org.openapijsonschematools.client.schemas.BooleanJsonSchema; +import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; +import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; +import org.openapijsonschematools.client.schemas.validation.PropertyEntry; +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; + +public class AdditionalpropertiesAllowsASchemaWhichShouldValidate { + // nest classes so all schemas and input/output classes can be public + + + public static class AdditionalProperties extends BooleanJsonSchema {} + + + public static class Foo extends AnyTypeJsonSchema {} + + + public static class Bar extends AnyTypeJsonSchema {} + + + public static class AdditionalpropertiesAllowsASchemaWhichShouldValidateMap extends FrozenMap { + AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(FrozenMap m) { + super(m); + } + public static final Set requiredKeys = Set.of(); + public static final Set optionalKeys = Set.of( + "foo", + "bar" + ); + public static AdditionalpropertiesAllowsASchemaWhichShouldValidateMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + return AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance().validate(arg, configuration); + } + + public Object foo() { + String key = "foo"; + throwIfKeyNotPresent(key); + return get(key); + } + + public Object bar() { + String key = "bar"; + throwIfKeyNotPresent(key); + return get(key); + } + + public boolean getAdditionalProperty(String name) { + throwIfKeyNotPresent(name); + return (boolean) get(name); + } + } + public static class AdditionalpropertiesAllowsASchemaWhichShouldValidateMapInput { + // optionalProperties + additionalProperties + } + + + public static class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 extends JsonSchema implements MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + private static AdditionalpropertiesAllowsASchemaWhichShouldValidate1 instance; + + protected AdditionalpropertiesAllowsASchemaWhichShouldValidate1() { + super(new JsonSchemaInfo() + .type(Set.of(FrozenMap.class)) + .properties(Map.ofEntries( + new PropertyEntry("foo", Foo.class), + new PropertyEntry("bar", Bar.class) + )) + .additionalProperties(AdditionalProperties.class) + ); + } + + public static AdditionalpropertiesAllowsASchemaWhichShouldValidate1 getInstance() { + if (instance == null) { + instance = new AdditionalpropertiesAllowsASchemaWhichShouldValidate1(); + } + return instance; + } + + public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return new AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(castProperties); + } + + @Override + public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + Set> pathSet = new HashSet<>(); + List pathToItem = List.of("args[0"); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + } + + + @Override + public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + if (arg instanceof FrozenMap) { + @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; + return getNewInstance(castArg, pathToItem, pathToSchemas); + } + throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); + } + } + +} diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index 2709cd2a805..2d5c3bf1bd0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -201,8 +201,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -219,7 +219,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index f8609db1b1b..49b48a9fd49 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -70,9 +70,9 @@ public static AdditionalpropertiesCanExistByItself1 getInstance() { return instance; } - public AdditionalpropertiesCanExistByItselfMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalpropertiesCanExistByItselfMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index f1891fa85bc..f6b93ce99f4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -189,8 +189,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -207,7 +207,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -403,8 +403,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -421,7 +421,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index b29559656be..6eb83db8bff 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -186,8 +186,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -204,7 +204,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -406,8 +406,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -424,7 +424,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -600,8 +600,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -618,8 +618,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index 41ee4ec9ed8..9f90237ea1a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -149,8 +149,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -167,8 +167,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -323,8 +323,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -341,8 +341,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -497,8 +497,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -515,8 +515,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -685,8 +685,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -703,8 +703,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index 02983246e35..f873ef3272d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -148,8 +148,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -166,8 +166,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -322,8 +322,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -340,8 +340,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -505,8 +505,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -523,8 +523,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index 4446093a579..7013dc1b9cb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -187,8 +187,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -205,7 +205,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -407,8 +407,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -425,7 +425,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -637,8 +637,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -655,7 +655,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public AllofWithBaseSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AllofWithBaseSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 39ed1b767d7..eb610048c63 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -160,8 +160,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -178,8 +178,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 9f627892917..2470b613727 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -165,8 +165,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -183,8 +183,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index e6b800646a0..69d5df14db8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -165,8 +165,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -183,8 +183,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index 19d77484949..ae53925565a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -164,8 +164,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -182,8 +182,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 83e7a546bce..fa7ba3eeb0c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -152,8 +152,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -170,8 +170,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -335,8 +335,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -353,8 +353,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index a00e8888cbd..9b7ee5472f5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -186,8 +186,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -204,7 +204,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -406,8 +406,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -424,7 +424,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -600,8 +600,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -618,8 +618,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index 72e4f4f76f9..926382aaf82 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -148,8 +148,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -166,8 +166,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -322,8 +322,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -340,8 +340,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 04231d50f1b..cac9b01ec54 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -165,8 +165,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -183,8 +183,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 58ab2a65a95..b3c3d8cb56c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -64,7 +64,7 @@ public static ArrayTypeMatchesArrays1 getInstance() { } @Override - public ArrayTypeMatchesArraysList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayTypeMatchesArraysList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; for (Object item: arg) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index fcf2576e048..aa37911b9fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -155,8 +155,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -173,8 +173,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index ec79b153ba9..118f4393d47 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -155,8 +155,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -173,8 +173,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index b5326d80e68..214139c31b2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -155,8 +155,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -173,8 +173,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index 5b3997b666c..924ef09d9ad 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index 07aec10af24..c349ae7dcee 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 136d4841da3..9167b28d1c4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -181,9 +181,9 @@ public static EnumsInProperties1 getInstance() { return instance; } - public EnumsInPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public EnumsInPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index febb57117b1..1911b0d4749 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -192,8 +192,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -210,7 +210,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public ForbiddenPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ForbiddenPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index dde1f532cad..1ef6b4823ab 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index 7864a0f7258..5a29c3a6560 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -230,8 +230,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -248,7 +248,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public InvalidStringValueForDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public InvalidStringValueForDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index ed6cab5c2cb..dd63836d3e2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index 149c9e1173f..4b49b54c43d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index 0c433e28a0b..f65a585e506 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index d41d5f9948b..7a321c3f3a4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index b30170bcc99..918d55c9ae3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index 4442d234f25..39dad87e178 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index e33984b762a..c757158ec39 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index 7b0602f89a8..5e972f081ae 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 9f41cb3700f..3b20496f6d0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index 6b548cbf295..e56c055c64e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 4c3106d8924..e98f3f1406a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 2266cf6d1f4..cbd216ac3a4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 450039c8756..7fffabbfb39 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 78c16f755f0..cbef41e361d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index 5a9fce8e955..ad097b04ffb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -336,8 +336,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -354,8 +354,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index c477cd34e7b..ab1d53cfa39 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -336,8 +336,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -354,8 +354,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index fbfb1916b89..f44ec82a91d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -58,7 +58,7 @@ public static Items2 getInstance() { } @Override - public ItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; for (Number item: arg) { @@ -126,7 +126,7 @@ public static Items1 getInstance() { } @Override - public ItemsList1 getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ItemsList1 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; for (FrozenList item: arg) { @@ -194,7 +194,7 @@ public static Items getInstance() { } @Override - public ItemsList2 getNewInstance(FrozenList>> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ItemsList2 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; for (FrozenList> item: arg) { @@ -268,7 +268,7 @@ public static NestedItems1 getInstance() { } @Override - public NestedItemsList getNewInstance(FrozenList>>> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NestedItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; for (FrozenList>> item: arg) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index cde7033e9f8..7f690428b01 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -336,8 +336,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -354,8 +354,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 0f78f84ec93..62d3a913d8d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -158,8 +158,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -176,8 +176,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index a361200f880..cbca67a0551 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -84,9 +84,9 @@ public static Not getInstance() { return instance; } - public NotMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NotMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); @@ -245,8 +245,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -263,8 +263,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index 79b60267c8c..55fde71e553 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -202,8 +202,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -220,7 +220,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public ObjectPropertiesValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectPropertiesValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 745073c2260..a4734529fd2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -152,8 +152,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -170,8 +170,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -335,8 +335,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -353,8 +353,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 2f1d16d5970..a85a0428b68 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -186,8 +186,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -204,7 +204,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -406,8 +406,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -424,7 +424,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -600,8 +600,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -618,8 +618,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index 84a29839b62..80a1eb0d493 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -148,8 +148,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -166,8 +166,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override @@ -322,8 +322,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -340,8 +340,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 03cb77324c1..30410f9f818 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -165,8 +165,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -183,8 +183,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index 9d439ee0f8b..7bb7afeb8bb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -183,8 +183,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -201,7 +201,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -403,8 +403,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -421,7 +421,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); @@ -498,8 +498,8 @@ public static OneofWithRequired1 getInstance() { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index f26f8bac15e..9a920ea1e1c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -157,8 +157,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -175,8 +175,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 19d0837a850..22a39a7614f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -157,8 +157,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -175,8 +175,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index b0c33f7066c..facdbc8b2f8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -209,8 +209,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -227,7 +227,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public PropertiesWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PropertiesWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index f5697483c9c..7ce2b5500a7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -184,8 +184,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -202,7 +202,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index c20d50f5ded..75a2d737d33 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -66,9 +66,9 @@ public static RefInAdditionalproperties1 getInstance() { return instance; } - public RefInAdditionalpropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RefInAdditionalpropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index 6287041dc77..6645196f9fc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -156,8 +156,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -174,8 +174,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index cb0378d1840..250a66a9e48 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -156,8 +156,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -174,8 +174,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index c5d0403d7be..115d9dcf29b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -60,7 +60,7 @@ public static RefInItems1 getInstance() { } @Override - public RefInItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RefInItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; for (Object item: arg) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index e6cf2496c8c..9afffcde5ac 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 70cb22fcd1d..2ee6a553b17 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -156,8 +156,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -174,8 +174,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index 692bc8b7bda..d3566df0e67 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -186,8 +186,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -204,7 +204,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public RefInPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RefInPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index d3f3d0ea868..fe9cfad75c0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -190,8 +190,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -208,7 +208,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public RequiredDefaultValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RequiredDefaultValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index 6ef09c20f92..1b86f422d27 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -203,8 +203,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -221,7 +221,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public RequiredValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RequiredValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 7d17288c635..917de04768f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -190,8 +190,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -208,7 +208,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public RequiredWithEmptyArrayMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RequiredWithEmptyArrayMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 24e697f30fb..4d5a0b1a28d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -189,8 +189,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -207,7 +207,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public RequiredWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RequiredWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index fdca0d23326..12edf8534c7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -140,9 +140,9 @@ public static TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 getInsta return instance; } - public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index 67118aec772..eceb2ed661d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index 695b1397acd..1f30cf52cd6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index 7536544bee7..9a8fd684f73 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index 9beabff7a0f..394ee72ff3b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 6b07aff6862..2ef62094738 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -154,8 +154,8 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override @@ -172,8 +172,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 3fc49c54e22..00afd29ae4c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -38,11 +38,6 @@ public static DoubleJsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 147a3493719..eb7da1dd8de 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -38,11 +38,6 @@ public static FloatJsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 0f3672b9e17..f5a2f1872d7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -41,11 +41,6 @@ public static Int32JsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index 45d5cfebb7c..ad2cfee3c81 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -43,11 +43,6 @@ public static Int64JsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 2a1a379d671..70e26275d1c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -43,11 +43,6 @@ public static IntJsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index 747ef03f3c9..87a15430a93 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -41,11 +41,6 @@ public static NumberJsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index e32ff0d1384..bc4f601b916 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -37,8 +37,8 @@ public {{../mapOutputJsonPathPiece.camelCase}} getNewInstance(FrozenMap arg, } {{else}} @Override -public FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; +public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } {{/if}} @@ -344,7 +344,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid @Override public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return (FrozenList) arg; } @Override @@ -376,7 +376,7 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else} FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castProperties = new FrozenMap<>(properties); return new {{mapOutputJsonPathPiece.camelCase}}(castProperties); {{else}} - return arg; + return (FrozenMap) arg; {{/if}} } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs index f3c812533cb..7fd14b0883d 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs @@ -38,11 +38,6 @@ public class DoubleJsonSchema extends JsonSchema implements NumberSchemaValidato return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs index f1b9597aae4..2f8f9435958 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs @@ -38,11 +38,6 @@ public class FloatJsonSchema extends JsonSchema implements NumberSchemaValidator return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs index 4a22b274382..d77737e3c60 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs @@ -41,11 +41,6 @@ public class Int32JsonSchema extends JsonSchema implements NumberSchemaValidator return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs index de10edca0e3..b47428525f5 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs @@ -43,11 +43,6 @@ public class Int64JsonSchema extends JsonSchema implements NumberSchemaValidator return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs index f4d4c65d1c3..c250c0a48a6 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs @@ -43,11 +43,6 @@ public class IntJsonSchema extends JsonSchema implements NumberSchemaValidator { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs index 17ce0fee722..09b5883bf89 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs @@ -41,11 +41,6 @@ public class NumberJsonSchema extends JsonSchema implements NumberSchemaValidato return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; From 5e6ed4a77d94e39f96c388461d28ef725cb9f85a Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 16 Dec 2023 13:16:05 -0800 Subject: [PATCH 06/16] Removes more unneeded methods --- ...ertiesAllowsASchemaWhichShouldValidate.java | 2 +- ...dditionalpropertiesAreAllowedByDefault.java | 6 +++--- .../AdditionalpropertiesCanExistByItself.java | 4 ++-- ...alpropertiesShouldNotLookInApplicators.java | 12 ++++++------ .../client/components/schemas/Allof.java | 14 +++++++------- .../schemas/AllofCombinedWithAnyofOneof.java | 8 ++++---- .../components/schemas/AllofSimpleTypes.java | 6 +++--- .../schemas/AllofWithBaseSchema.java | 18 +++++++++--------- .../schemas/AllofWithOneEmptySchema.java | 2 +- .../schemas/AllofWithTheFirstEmptySchema.java | 2 +- .../schemas/AllofWithTheLastEmptySchema.java | 2 +- .../schemas/AllofWithTwoEmptySchemas.java | 2 +- .../client/components/schemas/Anyof.java | 4 ++-- .../components/schemas/AnyofComplexTypes.java | 14 +++++++------- .../schemas/AnyofWithBaseSchema.java | 4 ++-- .../schemas/AnyofWithOneEmptySchema.java | 2 +- .../schemas/ArrayTypeMatchesArrays.java | 2 +- .../client/components/schemas/ByInt.java | 2 +- .../client/components/schemas/ByNumber.java | 2 +- .../components/schemas/BySmallNumber.java | 2 +- .../components/schemas/DateTimeFormat.java | 2 +- .../client/components/schemas/EmailFormat.java | 2 +- .../components/schemas/EnumsInProperties.java | 2 +- .../components/schemas/ForbiddenProperty.java | 6 +++--- .../components/schemas/HostnameFormat.java | 2 +- .../schemas/InvalidStringValueForDefault.java | 6 +++--- .../client/components/schemas/Ipv4Format.java | 2 +- .../client/components/schemas/Ipv6Format.java | 2 +- .../components/schemas/JsonPointerFormat.java | 2 +- .../components/schemas/MaximumValidation.java | 2 +- .../MaximumValidationWithUnsignedInteger.java | 2 +- .../components/schemas/MaxitemsValidation.java | 2 +- .../schemas/MaxlengthValidation.java | 2 +- .../Maxproperties0MeansTheObjectIsEmpty.java | 2 +- .../schemas/MaxpropertiesValidation.java | 2 +- .../components/schemas/MinimumValidation.java | 2 +- .../MinimumValidationWithSignedInteger.java | 2 +- .../components/schemas/MinitemsValidation.java | 2 +- .../schemas/MinlengthValidation.java | 2 +- .../schemas/MinpropertiesValidation.java | 2 +- .../NestedAllofToCheckValidationSemantics.java | 4 ++-- .../NestedAnyofToCheckValidationSemantics.java | 4 ++-- .../client/components/schemas/NestedItems.java | 16 ++++++++-------- .../NestedOneofToCheckValidationSemantics.java | 4 ++-- .../client/components/schemas/Not.java | 2 +- .../schemas/NotMoreComplexSchema.java | 4 ++-- .../schemas/ObjectPropertiesValidation.java | 6 +++--- .../client/components/schemas/Oneof.java | 4 ++-- .../components/schemas/OneofComplexTypes.java | 14 +++++++------- .../schemas/OneofWithBaseSchema.java | 4 ++-- .../schemas/OneofWithEmptySchema.java | 2 +- .../components/schemas/OneofWithRequired.java | 14 +++++++------- .../schemas/PatternIsNotAnchored.java | 2 +- .../components/schemas/PatternValidation.java | 2 +- .../PropertiesWithEscapedCharacters.java | 6 +++--- .../PropertyNamedRefThatIsNotAReference.java | 6 +++--- .../schemas/RefInAdditionalproperties.java | 2 +- .../client/components/schemas/RefInAllof.java | 2 +- .../client/components/schemas/RefInAnyof.java | 2 +- .../client/components/schemas/RefInItems.java | 2 +- .../client/components/schemas/RefInNot.java | 2 +- .../client/components/schemas/RefInOneof.java | 2 +- .../components/schemas/RefInProperty.java | 6 +++--- .../schemas/RequiredDefaultValidation.java | 6 +++--- .../components/schemas/RequiredValidation.java | 6 +++--- .../schemas/RequiredWithEmptyArray.java | 6 +++--- .../schemas/RequiredWithEscapedCharacters.java | 6 +++--- ...oesNotDoAnythingIfThePropertyIsMissing.java | 2 +- .../schemas/UniqueitemsFalseValidation.java | 2 +- .../schemas/UniqueitemsValidation.java | 2 +- .../client/components/schemas/UriFormat.java | 2 +- .../components/schemas/UriReferenceFormat.java | 2 +- .../components/schemas/UriTemplateFormat.java | 2 +- .../client/schemas/BooleanJsonSchema.java | 5 ----- .../client/schemas/DateJsonSchema.java | 5 ----- .../client/schemas/DateTimeJsonSchema.java | 5 ----- .../client/schemas/DecimalJsonSchema.java | 5 ----- .../client/schemas/ListJsonSchema.java | 4 ++-- .../client/schemas/NullJsonSchema.java | 5 ----- .../client/schemas/StringJsonSchema.java | 5 ----- .../client/schemas/UuidJsonSchema.java | 5 ----- .../SchemaClass/_validate_implementor.hbs | 14 +++++++------- .../packagename/schemas/BooleanJsonSchema.hbs | 5 ----- .../packagename/schemas/DateJsonSchema.hbs | 5 ----- .../packagename/schemas/DateTimeJsonSchema.hbs | 5 ----- .../packagename/schemas/DecimalJsonSchema.hbs | 5 ----- .../packagename/schemas/ListJsonSchema.hbs | 4 ++-- .../packagename/schemas/NullJsonSchema.hbs | 5 ----- .../packagename/schemas/StringJsonSchema.hbs | 5 ----- .../packagename/schemas/UuidJsonSchema.hbs | 5 ----- 90 files changed, 164 insertions(+), 234 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index 5580aa5f156..a386a564fdb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -116,7 +116,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Fr public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index 2d5c3bf1bd0..70c0e454521 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -221,11 +221,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -239,7 +239,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map a Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index 49b48a9fd49..089b6a8fdaf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -76,7 +76,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(FrozenMap arg, String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Boolean value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Boolean castValue = (Boolean) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -89,7 +89,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(FrozenMap arg, public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index f6b93ce99f4..9bcaa2e4ac6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -209,11 +209,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -227,7 +227,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -423,11 +423,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Boolean value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Boolean castValue = (Boolean) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -441,7 +441,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index 6eb83db8bff..f937e920fa5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -206,11 +206,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -224,7 +224,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -426,11 +426,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -444,7 +444,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -627,7 +627,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index 9f90237ea1a..7e198d32ef3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -176,7 +176,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -350,7 +350,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -524,7 +524,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -712,7 +712,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index f873ef3272d..337d4fe935e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -175,7 +175,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -349,7 +349,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -532,7 +532,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index 7013dc1b9cb..bada4de9050 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -207,11 +207,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -225,7 +225,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -427,11 +427,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -445,7 +445,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -657,11 +657,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public AllofWithBaseSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -675,7 +675,7 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfigurat Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index eb610048c63..1390d11cfe8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -187,7 +187,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 2470b613727..425793f602f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -192,7 +192,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 69d5df14db8..529ff12766d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -192,7 +192,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index ae53925565a..ae10cfe8b4d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -191,7 +191,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index fa7ba3eeb0c..34c1cb32993 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -179,7 +179,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -362,7 +362,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index 9b7ee5472f5..a81f189a59e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -206,11 +206,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -224,7 +224,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -426,11 +426,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -444,7 +444,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -627,7 +627,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index 926382aaf82..54b5f72f2c2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -175,7 +175,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -349,7 +349,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index cac9b01ec54..9db132dde0f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -192,7 +192,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index b3c3d8cb56c..452008541b7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -83,7 +83,7 @@ public ArrayTypeMatchesArraysList getNewInstance(FrozenList arg, List public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index aa37911b9fb..153348880e7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -182,7 +182,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index 118f4393d47..d6ab71cca92 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -182,7 +182,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index 214139c31b2..6d68c7216f0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -182,7 +182,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index 924ef09d9ad..2a6b7715960 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index c349ae7dcee..f81794939fc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 9167b28d1c4..a3ee3a61227 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -200,7 +200,7 @@ public EnumsInPropertiesMap getNewInstance(FrozenMap arg, List pathTo public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 1911b0d4749..24015ca3401 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -212,11 +212,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public ForbiddenPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -230,7 +230,7 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguratio Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index 1ef6b4823ab..b3105af1802 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index 5a29c3a6560..0e50e9b91ef 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -250,11 +250,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public InvalidStringValueForDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -268,7 +268,7 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaC Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index dd63836d3e2..3bcaa573435 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index 4b49b54c43d..bbe74812af2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index f65a585e506..2c72945e69b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index 7a321c3f3a4..3864cf3fc15 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 918d55c9ae3..755aff5e1fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index 39dad87e178..a87d7b93127 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index c757158ec39..23b72e7966c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index 5e972f081ae..5d04a46b797 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 3b20496f6d0..2fccba0b396 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index e56c055c64e..d9fbd7c73c9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index e98f3f1406a..98081524a99 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index cbd216ac3a4..eac444564de 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 7fffabbfb39..830b032ecf8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index cbef41e361d..797717300dd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index ad097b04ffb..cef26e7054f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -363,7 +363,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index ab1d53cfa39..4cf47679dcd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -363,7 +363,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index f44ec82a91d..e260c3501ca 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -61,7 +61,7 @@ public static Items2 getInstance() { public ItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; - for (Number item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); @@ -77,7 +77,7 @@ public ItemsList getNewInstance(FrozenList arg, List pathToItem, Path public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -129,7 +129,7 @@ public static Items1 getInstance() { public ItemsList1 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; - for (FrozenList item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); @@ -145,7 +145,7 @@ public ItemsList1 getNewInstance(FrozenList arg, List pathToItem, Pat public ItemsList1 validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -197,7 +197,7 @@ public static Items getInstance() { public ItemsList2 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; - for (FrozenList> item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); @@ -213,7 +213,7 @@ public ItemsList2 getNewInstance(FrozenList arg, List pathToItem, Pat public ItemsList2 validate(List>> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList>> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -271,7 +271,7 @@ public static NestedItems1 getInstance() { public NestedItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; - for (FrozenList>> item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); @@ -287,7 +287,7 @@ public NestedItemsList getNewInstance(FrozenList arg, List pathToItem public NestedItemsList validate(List>>> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList>>> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index 7f690428b01..dbe3a19f270 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -363,7 +363,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 62d3a913d8d..331f1307e4e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -185,7 +185,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index cbca67a0551..4a8f5d3ab7b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -103,7 +103,7 @@ public NotMap getNewInstance(FrozenMap arg, List pathToItem, PathToSc public NotMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -272,7 +272,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index 55fde71e553..a6cff12ecfb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -222,11 +222,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public ObjectPropertiesValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -240,7 +240,7 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaCon Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index a4734529fd2..261172fca2b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -179,7 +179,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -362,7 +362,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index a85a0428b68..2c76064d0e9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -206,11 +206,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -224,7 +224,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -426,11 +426,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -444,7 +444,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -627,7 +627,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index 80a1eb0d493..dddcbae3f08 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -175,7 +175,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -349,7 +349,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 30410f9f818..bb2fe73ccaf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -192,7 +192,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index 7bb7afeb8bb..62ce59d16dc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -203,11 +203,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -221,7 +221,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -423,11 +423,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -441,7 +441,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -506,7 +506,7 @@ public FrozenMap getNewInstance(FrozenMap arg, List pathToIte public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 9a920ea1e1c..1bb3864a1a1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -184,7 +184,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 22a39a7614f..e0a4d07fe2e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -184,7 +184,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index facdbc8b2f8..9fc84c4f0be 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -229,11 +229,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public PropertiesWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -247,7 +247,7 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, Sche Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 7ce2b5500a7..cfa1302d00e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -204,11 +204,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -222,7 +222,7 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index 75a2d737d33..47644448b1b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -85,7 +85,7 @@ public RefInAdditionalpropertiesMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index 6645196f9fc..635c94f750b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -183,7 +183,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index 250a66a9e48..0a736509ac6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -183,7 +183,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index 115d9dcf29b..2291255aa12 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -79,7 +79,7 @@ public RefInItemsList getNewInstance(FrozenList arg, List pathToItem, public RefInItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 9afffcde5ac..2842e660400 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 2ee6a553b17..249a4f648d0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -183,7 +183,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index d3566df0e67..01f1a1e578f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -206,11 +206,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public RefInPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -224,7 +224,7 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration co Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index fe9cfad75c0..5be88d2bc42 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -210,11 +210,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public RequiredDefaultValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -228,7 +228,7 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConf Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index 1b86f422d27..8ba10701082 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -223,11 +223,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public RequiredValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -241,7 +241,7 @@ public RequiredValidationMap validate(Map arg, SchemaConfigurati Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 917de04768f..fec0ce88b6c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -210,11 +210,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public RequiredWithEmptyArrayMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -228,7 +228,7 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfigu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 4d5a0b1a28d..77c6f438985 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -209,11 +209,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public RequiredWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -227,7 +227,7 @@ public RequiredWithEscapedCharactersMap validate(Map arg, Schema Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index 12edf8534c7..eca17d274e9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -159,7 +159,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index eceb2ed661d..5950d9ae77a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index 1f30cf52cd6..13b45ae3c63 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index 9a8fd684f73..3f4d6b9263a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index 394ee72ff3b..fccf52cf1a9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 2ef62094738..d52c22a8898 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -181,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index a3eb800e106..e550fed4598 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -36,11 +36,6 @@ public static BooleanJsonSchema getInstance() { return instance; } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index d3879c4aa7d..56882f6403b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -39,11 +39,6 @@ public static DateJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index a4156f324b1..8a2dcd8ba4b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -39,11 +39,6 @@ public static DateTimeJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index 8ab3588e1ec..a67ef350218 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -38,11 +38,6 @@ public static DecimalJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index aa9231afbf7..fead19fca16 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -38,8 +38,8 @@ public static ListJsonSchema getInstance() { } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index d67842a88ed..2d6938a4b22 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -36,11 +36,6 @@ public static NullJsonSchema getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg,pathToItem, pathSet); - } - @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index c6df642418c..7c46f5ba114 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -39,11 +39,6 @@ public static StringJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index 506704c7b47..48c8acacb80 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -39,11 +39,6 @@ public static UuidJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index bc4f601b916..e5c35721366 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -27,7 +27,7 @@ public {{../mapOutputJsonPathPiece.camelCase}} getNewInstance(FrozenMap arg, String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - {{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); {{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} castValue = ({{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -46,7 +46,7 @@ public FrozenMap getNewInstance(FrozenMap arg, List pathToIte public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap{{/if}} validate(Map src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -61,7 +61,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCas {{#if ../arrayOutputJsonPathPiece}} ArrayList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> items = new ArrayList<>(); int i = 0; - for ({{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}} item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); @@ -80,7 +80,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCas public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} validate(List<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -364,11 +364,11 @@ public FrozenList validate(List arg, SchemaConfiguration configu public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { {{#if mapOutputJsonPathPiece}} LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> properties = new LinkedHashMap<>(); - for(Map.Entry src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> entry: arg.entrySet()) { + for(Map.Entry entry: arg.entrySet()) { String propertyName = entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - {{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); {{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} castValue = ({{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -385,7 +385,7 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else} Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs index 81ce4f7e596..abe93b769bf 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs @@ -36,11 +36,6 @@ public class BooleanJsonSchema extends JsonSchema implements BooleanSchemaValida return instance; } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs index 33a8650e64c..22f9b5910f3 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs @@ -39,11 +39,6 @@ public class DateJsonSchema extends JsonSchema implements StringSchemaValidator return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs index 22595d9e41d..f28d2851f70 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs @@ -39,11 +39,6 @@ public class DateTimeJsonSchema extends JsonSchema implements StringSchemaValida return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs index bbac1f3e119..607327f7cfe 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs @@ -38,11 +38,6 @@ public class DecimalJsonSchema extends JsonSchema implements StringSchemaValidat return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs index 9e824d61dc8..ae71362e5c8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs @@ -38,8 +38,8 @@ public class ListJsonSchema extends JsonSchema implements ListSchemaValidator getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs index 47cdc721df5..ab33635a16d 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs @@ -36,11 +36,6 @@ public class NullJsonSchema extends JsonSchema implements NullSchemaValidator { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg,pathToItem, pathSet); - } - @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs index f323a2a6f05..f2ef9176b77 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs @@ -39,11 +39,6 @@ public class StringJsonSchema extends JsonSchema implements StringSchemaValidato return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs index 2f2c1d4925f..462b953cb06 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs @@ -39,11 +39,6 @@ public class UuidJsonSchema extends JsonSchema implements StringSchemaValidator return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; From 9d9d2f9792093fdb96aab70b7695feff79635168 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 17 Dec 2023 18:03:03 -0800 Subject: [PATCH 07/16] Fixes java tests --- ...rtiesAllowsASchemaWhichShouldValidate.java | 1 - ...ditionalpropertiesAreAllowedByDefault.java | 2 +- .../AdditionalpropertiesCanExistByItself.java | 1 - ...lpropertiesShouldNotLookInApplicators.java | 5 +- .../client/components/schemas/Allof.java | 6 +- .../schemas/AllofCombinedWithAnyofOneof.java | 8 +-- .../components/schemas/AllofSimpleTypes.java | 6 +- .../schemas/AllofWithBaseSchema.java | 6 +- .../schemas/AllofWithOneEmptySchema.java | 2 +- .../schemas/AllofWithTheFirstEmptySchema.java | 2 +- .../schemas/AllofWithTheLastEmptySchema.java | 2 +- .../schemas/AllofWithTwoEmptySchemas.java | 2 +- .../client/components/schemas/Anyof.java | 4 +- .../components/schemas/AnyofComplexTypes.java | 6 +- .../schemas/AnyofWithBaseSchema.java | 4 +- .../schemas/AnyofWithOneEmptySchema.java | 2 +- .../client/components/schemas/ByInt.java | 2 +- .../client/components/schemas/ByNumber.java | 2 +- .../components/schemas/BySmallNumber.java | 2 +- .../components/schemas/DateTimeFormat.java | 2 +- .../components/schemas/EmailFormat.java | 2 +- .../components/schemas/ForbiddenProperty.java | 2 +- .../components/schemas/HostnameFormat.java | 2 +- .../schemas/InvalidStringValueForDefault.java | 2 +- .../client/components/schemas/Ipv4Format.java | 2 +- .../client/components/schemas/Ipv6Format.java | 2 +- .../components/schemas/JsonPointerFormat.java | 2 +- .../components/schemas/MaximumValidation.java | 2 +- .../MaximumValidationWithUnsignedInteger.java | 2 +- .../schemas/MaxitemsValidation.java | 2 +- .../schemas/MaxlengthValidation.java | 2 +- .../Maxproperties0MeansTheObjectIsEmpty.java | 2 +- .../schemas/MaxpropertiesValidation.java | 2 +- .../components/schemas/MinimumValidation.java | 2 +- .../MinimumValidationWithSignedInteger.java | 2 +- .../schemas/MinitemsValidation.java | 2 +- .../schemas/MinlengthValidation.java | 2 +- .../schemas/MinpropertiesValidation.java | 2 +- ...NestedAllofToCheckValidationSemantics.java | 4 +- ...NestedAnyofToCheckValidationSemantics.java | 4 +- ...NestedOneofToCheckValidationSemantics.java | 4 +- .../client/components/schemas/Not.java | 2 +- .../schemas/NotMoreComplexSchema.java | 2 +- .../schemas/ObjectPropertiesValidation.java | 2 +- .../client/components/schemas/Oneof.java | 4 +- .../components/schemas/OneofComplexTypes.java | 6 +- .../schemas/OneofWithBaseSchema.java | 4 +- .../schemas/OneofWithEmptySchema.java | 2 +- .../components/schemas/OneofWithRequired.java | 4 +- .../schemas/PatternIsNotAnchored.java | 2 +- .../components/schemas/PatternValidation.java | 2 +- .../PropertiesWithEscapedCharacters.java | 2 +- .../PropertyNamedRefThatIsNotAReference.java | 2 +- .../schemas/RefInAdditionalproperties.java | 1 - .../client/components/schemas/RefInAllof.java | 2 +- .../client/components/schemas/RefInAnyof.java | 2 +- .../client/components/schemas/RefInNot.java | 2 +- .../client/components/schemas/RefInOneof.java | 2 +- .../components/schemas/RefInProperty.java | 2 +- .../schemas/RequiredDefaultValidation.java | 2 +- .../schemas/RequiredValidation.java | 2 +- .../schemas/RequiredWithEmptyArray.java | 2 +- .../RequiredWithEscapedCharacters.java | 2 +- .../schemas/UniqueitemsFalseValidation.java | 2 +- .../schemas/UniqueitemsValidation.java | 2 +- .../client/components/schemas/UriFormat.java | 2 +- .../schemas/UriReferenceFormat.java | 2 +- .../components/schemas/UriTemplateFormat.java | 2 +- .../client/schemas/AnyTypeJsonSchema.java | 4 +- .../client/schemas/NotAnyTypeJsonSchema.java | 4 +- .../client/schemas/validation/JsonSchema.java | 4 +- .../validation/UnsetAnyTypeJsonSchema.java | 4 +- .../client/schemas/ArrayTypeSchemaTest.java | 46 +++----------- .../client/schemas/ObjectTypeSchemaTest.java | 63 +++++-------------- .../schemas/validation/JsonSchemaTest.java | 1 - .../generators/JavaClientGenerator.java | 8 --- .../SchemaClass/_validate_implementor.hbs | 2 +- .../packagename/schemas/AnyTypeJsonSchema.hbs | 4 +- .../schemas/NotAnyTypeJsonSchema.hbs | 4 +- .../schemas/validation/JsonSchema.hbs | 4 +- .../validation/UnsetAnyTypeJsonSchema.hbs | 4 +- .../schemas/ArrayTypeSchemaTest.hbs | 46 +++----------- .../schemas/ObjectTypeSchemaTest.hbs | 63 +++++-------------- .../schemas/validation/JsonSchemaTest.hbs | 1 - 84 files changed, 152 insertions(+), 288 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index a386a564fdb..d9ae9be4f00 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index 70c0e454521..88b12be4724 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -210,7 +210,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index 089b6a8fdaf..926a34502ec 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 9bcaa2e4ac6..3846baf0065 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -16,7 +16,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -198,7 +197,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -412,7 +411,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index f937e920fa5..c5a0e07b199 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -195,7 +195,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -415,7 +415,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -609,7 +609,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index 7e198d32ef3..6d915d800f0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -158,7 +158,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -332,7 +332,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -506,7 +506,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -694,7 +694,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index 337d4fe935e..d47607b0924 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -157,7 +157,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -331,7 +331,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -514,7 +514,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index bada4de9050..ccf92dba018 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -196,7 +196,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -416,7 +416,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -646,7 +646,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 1390d11cfe8..50bf57f19c8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -169,7 +169,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 425793f602f..f1f412b28ac 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -174,7 +174,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 529ff12766d..602ddfa942f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -174,7 +174,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index ae10cfe8b4d..d9b400772c1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -173,7 +173,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 34c1cb32993..2954092b6b3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -161,7 +161,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -344,7 +344,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index a81f189a59e..044a970c49b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -195,7 +195,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -415,7 +415,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -609,7 +609,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index 54b5f72f2c2..f839de8a63f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -157,7 +157,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -331,7 +331,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 9db132dde0f..0a3eb919583 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -174,7 +174,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index 153348880e7..29e14840b69 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -164,7 +164,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index d6ab71cca92..c143a869f73 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -164,7 +164,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index 6d68c7216f0..145eff27a6e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -164,7 +164,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index 2a6b7715960..b95cb0544a2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index f81794939fc..d0ce669bf7b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 24015ca3401..aca333f475a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -201,7 +201,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index b3105af1802..c84ccee0f25 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index 0e50e9b91ef..fb3021eee17 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -239,7 +239,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index 3bcaa573435..ea93d08e724 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index bbe74812af2..8946e5f491a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index 2c72945e69b..a2b630be04f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index 3864cf3fc15..4d6f07e21dc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 755aff5e1fb..b8e684cb5be 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index a87d7b93127..0ced583aee0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 23b72e7966c..ecf584da152 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index 5d04a46b797..f402908dc65 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 2fccba0b396..0e19a2c4ce1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index d9fbd7c73c9..6a55016b4b7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 98081524a99..5e5ac29482e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index eac444564de..2cb4816815b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 830b032ecf8..0bb3581a1ec 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 797717300dd..441a176a3fc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index cef26e7054f..3cc81b4c145 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -345,7 +345,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index 4cf47679dcd..b0031e1b2f0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -345,7 +345,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index dbe3a19f270..6d61bf77909 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -345,7 +345,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 331f1307e4e..1cae94fbc2d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -167,7 +167,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 4a8f5d3ab7b..c9b08b5041c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -254,7 +254,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index a6cff12ecfb..ebf691dd545 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -211,7 +211,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 261172fca2b..68d1a805c9b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -161,7 +161,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -344,7 +344,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 2c76064d0e9..88de982714f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -195,7 +195,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -415,7 +415,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -609,7 +609,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index dddcbae3f08..6f2fe2d23c4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -157,7 +157,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -331,7 +331,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index bb2fe73ccaf..ab1604b3338 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -174,7 +174,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index 62ce59d16dc..75051e8e376 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -192,7 +192,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -412,7 +412,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 1bb3864a1a1..403ff1b0780 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -166,7 +166,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index e0a4d07fe2e..bff1dcfff09 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -166,7 +166,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index 9fc84c4f0be..ee03cc129fe 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -218,7 +218,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index cfa1302d00e..2d063228561 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -193,7 +193,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index 47644448b1b..e3312b3bd56 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index 635c94f750b..2b10021e4c5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -165,7 +165,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index 0a736509ac6..4377e620872 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -165,7 +165,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 2842e660400..2ef3f2e0f8d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 249a4f648d0..3014ef80640 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -165,7 +165,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index 01f1a1e578f..ce5c4897c15 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -195,7 +195,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 5be88d2bc42..6fe1687ad9f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -199,7 +199,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index 8ba10701082..a682324e0d8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -212,7 +212,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index fec0ce88b6c..836dc8e0ed3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -199,7 +199,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 77c6f438985..3ea174ad68c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -198,7 +198,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index 5950d9ae77a..4d993ebbe46 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index 13b45ae3c63..d031dcbf794 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index 3f4d6b9263a..16948f3f4bc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index fccf52cf1a9..e22ca660423 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index d52c22a8898..c0e1191880b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -163,7 +163,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index b21cfeb0e5c..46043afc6da 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -152,7 +152,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -170,7 +170,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index 03784227ca2..42d1784fca0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -121,7 +121,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -139,7 +139,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index 177b9b98d90..d57eb6cac63 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -272,7 +272,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; @@ -286,7 +286,7 @@ protected FrozenList castToAllowedTypes(List arg, List pathTo return new FrozenList<>(argFixed); } - protected FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index bb75b95544f..1427e4da9e0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -109,7 +109,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -127,7 +127,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index d7dd5c3432e..16375e28376 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -29,7 +29,7 @@ public class ArrayTypeSchemaTest { new LinkedHashSet<>() ); - public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator> { + public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator> { public ArrayWithItemsSchema() { super(new JsonSchemaInfo() .type(Set.of(FrozenList.class)) @@ -38,30 +38,15 @@ public ArrayWithItemsSchema() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -88,7 +73,7 @@ public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfigurat } } - public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { + public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { public ArrayWithOutputClsSchema() { super(new JsonSchemaInfo() .type(Set.of(FrozenList.class)) @@ -98,25 +83,10 @@ public ArrayWithOutputClsSchema() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); @@ -132,7 +102,7 @@ public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List< public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index 8c647153b2d..11000228fdc 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; -import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -33,7 +32,7 @@ public class ObjectTypeSchemaTest { new LinkedHashSet<>() ); - public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithPropsSchema instance; private ObjectWithPropsSchema() { super(new JsonSchemaInfo() @@ -53,20 +52,15 @@ public static ObjectWithPropsSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -83,7 +77,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithAddpropsSchema instance; private ObjectWithAddpropsSchema() { super(new JsonSchemaInfo() @@ -100,30 +94,15 @@ public static ObjectWithAddpropsSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -140,7 +119,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithPropsAndAddpropsSchema instance; private ObjectWithPropsAndAddpropsSchema() { super(new JsonSchemaInfo() @@ -160,20 +139,15 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -201,7 +175,7 @@ public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaCo } - public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { private static ObjectWithOutputTypeSchema instance; public ObjectWithOutputTypeSchema() { super(new JsonSchemaInfo() @@ -220,20 +194,15 @@ public static ObjectWithOutputTypeSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public ObjectWithOutputTypeSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return new ObjectWithOutputTypeSchemaMap(arg); + public ObjectWithOutputTypeSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return new ObjectWithOutputTypeSchemaMap((FrozenMap) arg); } @Override public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 73b11d7c6a2..f66926cf23d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -11,7 +11,6 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import java.util.Map; class SomeSchema extends JsonSchema { private static SomeSchema instance; diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java index e3e2b8b663a..c0e7fcc7643 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java @@ -1514,7 +1514,6 @@ public Set getImports(String sourceJsonPath, CodegenSchema schema, Featu imports.add("import "+packageName + ".schemas.validation.MapSchemaValidator;"); addPropertiesValidator(schema, imports); addRequiredValidator(schema, imports); - addAdditionalPropertiesValidator(schema, imports); addAllOfValidator(schema, imports); addAnyOfValidator(schema, imports); addOneOfValidator(schema, imports); @@ -1576,12 +1575,6 @@ private void addRequiredValidator(CodegenSchema schema, Set imports) { } } - private void addAdditionalPropertiesValidator(CodegenSchema schema, Set imports) { - if (schema.additionalProperties != null) { - imports.add("import "+packageName + ".schemas.validation.AdditionalPropertiesValidator;"); - } - } - private void addMultipleOfValidator(CodegenSchema schema, Set imports) { if (schema.multipleOf != null) { imports.add("import java.math.BigDecimal;"); @@ -1628,7 +1621,6 @@ private void addMapSchemaImports(Set imports, CodegenSchema schema) { imports.add("import java.util.Map;"); imports.add("import java.util.ArrayList;"); // for castToAllowedTypes addRequiredValidator(schema, imports); - addAdditionalPropertiesValidator(schema, imports); addPropertiesValidator(schema, imports); addAllOfValidator(schema, imports); addAnyOfValidator(schema, imports); diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index e5c35721366..ba8a5cb18a3 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -352,7 +352,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs index 28747ff90c6..df0154a62a3 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs @@ -152,7 +152,7 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -170,7 +170,7 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs index b44b9ea9939..9d863421b24 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -121,7 +121,7 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -139,7 +139,7 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index d18f0c5c1da..4ffe1388136 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -272,7 +272,7 @@ public abstract class JsonSchema { return arg; } - protected FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; @@ -286,7 +286,7 @@ public abstract class JsonSchema { return new FrozenList<>(argFixed); } - protected FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index 4780ffd55e4..1bcf8f2e589 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -109,7 +109,7 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -127,7 +127,7 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs index e5e06496340..ef5ed276b07 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs @@ -29,7 +29,7 @@ public class ArrayTypeSchemaTest { new LinkedHashSet<>() ); - public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator> { + public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator> { public ArrayWithItemsSchema() { super(new JsonSchemaInfo() .type(Set.of(FrozenList.class)) @@ -38,30 +38,15 @@ public class ArrayTypeSchemaTest { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenList) arg; } @Override public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -88,7 +73,7 @@ public class ArrayTypeSchemaTest { } } - public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { + public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { public ArrayWithOutputClsSchema() { super(new JsonSchemaInfo() .type(Set.of(FrozenList.class)) @@ -98,25 +83,10 @@ public class ArrayTypeSchemaTest { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); @@ -132,7 +102,7 @@ public class ArrayTypeSchemaTest { public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs index 40f75fa8933..139c89f74d1 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs @@ -14,7 +14,6 @@ import {{{packageName}}}.schemas.validation.MapSchemaValidator; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; -import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -33,7 +32,7 @@ public class ObjectTypeSchemaTest { new LinkedHashSet<>() ); - public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithPropsSchema instance; private ObjectWithPropsSchema() { super(new JsonSchemaInfo() @@ -53,20 +52,15 @@ public class ObjectTypeSchemaTest { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -83,7 +77,7 @@ public class ObjectTypeSchemaTest { } } - public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithAddpropsSchema instance; private ObjectWithAddpropsSchema() { super(new JsonSchemaInfo() @@ -100,30 +94,15 @@ public class ObjectTypeSchemaTest { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -140,7 +119,7 @@ public class ObjectTypeSchemaTest { } } - public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithPropsAndAddpropsSchema instance; private ObjectWithPropsAndAddpropsSchema() { super(new JsonSchemaInfo() @@ -160,20 +139,15 @@ public class ObjectTypeSchemaTest { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return (FrozenMap) arg; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -201,7 +175,7 @@ public class ObjectTypeSchemaTest { } - public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { private static ObjectWithOutputTypeSchema instance; public ObjectWithOutputTypeSchema() { super(new JsonSchemaInfo() @@ -220,20 +194,15 @@ public class ObjectTypeSchemaTest { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public ObjectWithOutputTypeSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return new ObjectWithOutputTypeSchemaMap(arg); + public ObjectWithOutputTypeSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return new ObjectWithOutputTypeSchemaMap((FrozenMap) arg); } @Override public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs index cc13d02ee25..c70d858a0b0 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs @@ -11,7 +11,6 @@ import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import java.util.Map; class SomeSchema extends JsonSchema { private static SomeSchema instance; From 09c15434fb8f988d95ce9c6422a802a91b7a0c8d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 17 Dec 2023 20:56:39 -0800 Subject: [PATCH 08/16] Removes getNewInstance from non collection types --- ...ditionalpropertiesAreAllowedByDefault.java | 28 +---- ...lpropertiesShouldNotLookInApplicators.java | 56 ++------- .../client/components/schemas/Allof.java | 84 ++----------- .../schemas/AllofCombinedWithAnyofOneof.java | 112 +++--------------- .../components/schemas/AllofSimpleTypes.java | 84 ++----------- .../schemas/AllofWithBaseSchema.java | 84 ++----------- .../schemas/AllofWithOneEmptySchema.java | 28 +---- .../schemas/AllofWithTheFirstEmptySchema.java | 28 +---- .../schemas/AllofWithTheLastEmptySchema.java | 28 +---- .../schemas/AllofWithTwoEmptySchemas.java | 28 +---- .../client/components/schemas/Anyof.java | 56 ++------- .../components/schemas/AnyofComplexTypes.java | 84 ++----------- .../schemas/AnyofWithBaseSchema.java | 63 ++-------- .../schemas/AnyofWithOneEmptySchema.java | 28 +---- .../client/components/schemas/ByInt.java | 28 +---- .../client/components/schemas/ByNumber.java | 28 +---- .../components/schemas/BySmallNumber.java | 28 +---- .../components/schemas/DateTimeFormat.java | 28 +---- .../components/schemas/EmailFormat.java | 28 +---- .../schemas/EnumWith0DoesNotMatchFalse.java | 7 +- .../schemas/EnumWith1DoesNotMatchTrue.java | 7 +- .../schemas/EnumWithEscapedCharacters.java | 7 +- .../schemas/EnumWithFalseDoesNotMatch0.java | 7 +- .../schemas/EnumWithTrueDoesNotMatch1.java | 7 +- .../components/schemas/EnumsInProperties.java | 14 +-- .../components/schemas/ForbiddenProperty.java | 28 +---- .../components/schemas/HostnameFormat.java | 28 +---- ...ouldNotRaiseErrorWhenFloatDivisionInf.java | 7 +- .../schemas/InvalidStringValueForDefault.java | 35 +----- .../client/components/schemas/Ipv4Format.java | 28 +---- .../client/components/schemas/Ipv6Format.java | 28 +---- .../components/schemas/JsonPointerFormat.java | 28 +---- .../components/schemas/MaximumValidation.java | 28 +---- .../MaximumValidationWithUnsignedInteger.java | 28 +---- .../schemas/MaxitemsValidation.java | 28 +---- .../schemas/MaxlengthValidation.java | 28 +---- .../Maxproperties0MeansTheObjectIsEmpty.java | 28 +---- .../schemas/MaxpropertiesValidation.java | 28 +---- .../components/schemas/MinimumValidation.java | 28 +---- .../MinimumValidationWithSignedInteger.java | 28 +---- .../schemas/MinitemsValidation.java | 28 +---- .../schemas/MinlengthValidation.java | 28 +---- .../schemas/MinpropertiesValidation.java | 28 +---- ...NestedAllofToCheckValidationSemantics.java | 56 ++------- ...NestedAnyofToCheckValidationSemantics.java | 56 ++------- ...NestedOneofToCheckValidationSemantics.java | 56 ++------- .../client/components/schemas/Not.java | 28 +---- .../schemas/NotMoreComplexSchema.java | 28 +---- .../schemas/NulCharactersInStrings.java | 7 +- .../schemas/ObjectPropertiesValidation.java | 28 +---- .../client/components/schemas/Oneof.java | 56 ++------- .../components/schemas/OneofComplexTypes.java | 84 ++----------- .../schemas/OneofWithBaseSchema.java | 63 ++-------- .../schemas/OneofWithEmptySchema.java | 28 +---- .../components/schemas/OneofWithRequired.java | 56 ++------- .../schemas/PatternIsNotAnchored.java | 28 +---- .../components/schemas/PatternValidation.java | 28 +---- .../PropertiesWithEscapedCharacters.java | 28 +---- .../PropertyNamedRefThatIsNotAReference.java | 28 +---- .../client/components/schemas/RefInAllof.java | 28 +---- .../client/components/schemas/RefInAnyof.java | 28 +---- .../client/components/schemas/RefInNot.java | 28 +---- .../client/components/schemas/RefInOneof.java | 28 +---- .../components/schemas/RefInProperty.java | 28 +---- .../schemas/RequiredDefaultValidation.java | 28 +---- .../schemas/RequiredValidation.java | 28 +---- .../schemas/RequiredWithEmptyArray.java | 28 +---- .../RequiredWithEscapedCharacters.java | 28 +---- .../schemas/SimpleEnumValidation.java | 7 +- ...esNotDoAnythingIfThePropertyIsMissing.java | 7 +- .../schemas/UniqueitemsFalseValidation.java | 28 +---- .../schemas/UniqueitemsValidation.java | 28 +---- .../client/components/schemas/UriFormat.java | 28 +---- .../schemas/UriReferenceFormat.java | 28 +---- .../components/schemas/UriTemplateFormat.java | 28 +---- .../validation/BooleanSchemaValidator.java | 1 - .../client/schemas/validation/JsonSchema.java | 16 +++ .../validation/NullSchemaValidator.java | 1 - .../validation/NumberSchemaValidator.java | 1 - .../validation/StringSchemaValidator.java | 1 - .../SchemaClass/_validate_implementor.hbs | 63 ++-------- .../validation/BooleanSchemaValidator.hbs | 1 - .../schemas/validation/JsonSchema.hbs | 16 +++ .../validation/NullSchemaValidator.hbs | 1 - .../validation/NumberSchemaValidator.hbs | 1 - .../validation/StringSchemaValidator.hbs | 1 - 86 files changed, 403 insertions(+), 2234 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index 88b12be4724..1e952cd0b96 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -100,11 +100,6 @@ public static AdditionalpropertiesAreAllowedByDefault1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -115,12 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -133,12 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -151,7 +136,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -170,11 +155,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -185,7 +165,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 3846baf0065..39e9c75e070 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -87,11 +87,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -102,12 +97,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -120,12 +110,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -138,7 +123,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -157,11 +142,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -172,7 +152,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -301,11 +281,6 @@ public static AdditionalpropertiesShouldNotLookInApplicators1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -316,12 +291,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -334,12 +304,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -352,7 +317,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -371,11 +336,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -386,7 +346,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index c5a0e07b199..4e8bbf79342 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -85,11 +85,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -100,12 +95,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -118,12 +108,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -136,7 +121,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -155,11 +140,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -170,7 +150,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -305,11 +285,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -320,12 +295,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -338,12 +308,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -356,7 +321,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -375,11 +340,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -390,7 +350,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -499,11 +459,6 @@ public static Allof1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -514,12 +469,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -532,12 +482,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -550,7 +495,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -569,11 +514,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -584,7 +524,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index 6d915d800f0..1a5902983f9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -48,11 +48,6 @@ public static Schema02 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -63,12 +58,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -81,12 +71,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -99,7 +84,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -118,11 +103,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -133,7 +113,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -222,11 +202,6 @@ public static Schema01 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -237,12 +212,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -255,12 +225,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -273,7 +238,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -292,11 +257,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -307,7 +267,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -396,11 +356,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -411,12 +366,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -429,12 +379,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -447,7 +392,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -466,11 +411,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -481,7 +421,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -584,11 +524,6 @@ public static AllofCombinedWithAnyofOneof1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -599,12 +534,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -617,12 +547,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -635,7 +560,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -654,11 +579,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -669,7 +589,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index d47607b0924..9a3439a6ebe 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -47,11 +47,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -62,12 +57,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -80,12 +70,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -98,7 +83,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -117,11 +102,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -132,7 +112,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -221,11 +201,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -236,12 +211,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -254,12 +224,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -272,7 +237,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -291,11 +256,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -306,7 +266,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -404,11 +364,6 @@ public static AllofSimpleTypes1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -419,12 +374,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -437,12 +387,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -455,7 +400,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -474,11 +419,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -489,7 +429,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index ccf92dba018..83f05672c95 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -86,11 +86,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -101,12 +96,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -119,12 +109,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -137,7 +122,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -156,11 +141,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -171,7 +151,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -306,11 +286,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -321,12 +296,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -339,12 +309,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -357,7 +322,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -376,11 +341,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -391,7 +351,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -536,11 +496,6 @@ public static AllofWithBaseSchema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -551,12 +506,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -569,12 +519,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -587,7 +532,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -606,11 +551,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -621,7 +561,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 50bf57f19c8..3dcd6c3783d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -59,11 +59,6 @@ public static AllofWithOneEmptySchema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -74,12 +69,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -92,12 +82,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -110,7 +95,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -129,11 +114,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -144,7 +124,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index f1f412b28ac..6a3eeebe26e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -64,11 +64,6 @@ public static AllofWithTheFirstEmptySchema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -79,12 +74,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -97,12 +87,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -115,7 +100,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -134,11 +119,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -149,7 +129,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 602ddfa942f..a8ebc292f1d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -64,11 +64,6 @@ public static AllofWithTheLastEmptySchema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -79,12 +74,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -97,12 +87,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -115,7 +100,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -134,11 +119,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -149,7 +129,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index d9b400772c1..aabad3de83d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -63,11 +63,6 @@ public static AllofWithTwoEmptySchemas1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -78,12 +73,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -96,12 +86,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -114,7 +99,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -133,11 +118,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -148,7 +128,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 2954092b6b3..a544d0541c0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -51,11 +51,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -66,12 +61,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -84,12 +74,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -102,7 +87,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -121,11 +106,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -136,7 +116,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -234,11 +214,6 @@ public static Anyof1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -249,12 +224,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -267,12 +237,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -285,7 +250,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -304,11 +269,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -319,7 +279,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index 044a970c49b..d0dcf57b71e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -85,11 +85,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -100,12 +95,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -118,12 +108,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -136,7 +121,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -155,11 +140,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -170,7 +150,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -305,11 +285,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -320,12 +295,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -338,12 +308,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -356,7 +321,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -375,11 +340,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -390,7 +350,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -499,11 +459,6 @@ public static AnyofComplexTypes1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -514,12 +469,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -532,12 +482,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -550,7 +495,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -569,11 +514,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -584,7 +524,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index f839de8a63f..d5774f464af 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -47,11 +47,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -62,12 +57,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -80,12 +70,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -98,7 +83,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -117,11 +102,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -132,7 +112,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -221,11 +201,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -236,12 +211,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -254,12 +224,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -272,7 +237,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -291,11 +256,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -306,7 +266,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -407,11 +367,6 @@ public static AnyofWithBaseSchema1 getInstance() { return instance; } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -420,7 +375,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 0a3eb919583..496d7c5a707 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -64,11 +64,6 @@ public static AnyofWithOneEmptySchema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -79,12 +74,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -97,12 +87,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -115,7 +100,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -134,11 +119,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -149,7 +129,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index 29e14840b69..f88a12ad34c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -54,11 +54,6 @@ public static ByInt1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -69,12 +64,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -87,12 +77,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -105,7 +90,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -124,11 +109,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -139,7 +119,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index c143a869f73..9d8e92fe3aa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -54,11 +54,6 @@ public static ByNumber1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -69,12 +64,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -87,12 +77,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -105,7 +90,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -124,11 +109,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -139,7 +119,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index 145eff27a6e..626455a456d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -54,11 +54,6 @@ public static BySmallNumber1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -69,12 +64,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -87,12 +77,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -105,7 +90,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -124,11 +109,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -139,7 +119,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index b95cb0544a2..f6737baa268 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -53,11 +53,6 @@ public static DateTimeFormat1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index d0ce669bf7b..f30950863e9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -53,11 +53,6 @@ public static EmailFormat1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java index 54040176335..0f9c461affe 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java @@ -52,11 +52,6 @@ public static EnumWith0DoesNotMatchFalse1 getInstance() { return instance; } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -65,7 +60,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java index c1b4c4fac37..3b547c80445 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java @@ -52,11 +52,6 @@ public static EnumWith1DoesNotMatchTrue1 getInstance() { return instance; } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -65,7 +60,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java index 4dbc08d52bc..570ac16a86e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java @@ -50,11 +50,6 @@ public static EnumWithEscapedCharacters1 getInstance() { return instance; } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,7 +58,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java index c0f1836feae..0a5b1aebb85 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java @@ -47,11 +47,6 @@ public static EnumWithFalseDoesNotMatch01 getInstance() { return instance; } - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -60,7 +55,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java index 292c845de66..eb2aa0da15a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java @@ -47,11 +47,6 @@ public static EnumWithTrueDoesNotMatch11 getInstance() { return instance; } - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -60,7 +55,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index a3ee3a61227..7d55e92ee38 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -46,11 +46,6 @@ public static Foo getInstance() { return instance; } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -59,7 +54,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override @@ -92,11 +87,6 @@ public static Bar getInstance() { return instance; } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -105,7 +95,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index aca333f475a..8a49a4b973e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -91,11 +91,6 @@ public static ForbiddenProperty1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -106,12 +101,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -124,12 +114,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -142,7 +127,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -161,11 +146,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -176,7 +156,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index c84ccee0f25..295e1283911 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -53,11 +53,6 @@ public static HostnameFormat1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java index 19352695a36..0e15a3c46b2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java @@ -50,11 +50,6 @@ public static InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1 getInstanc return instance; } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,7 +58,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index fb3021eee17..d599993deb6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -51,11 +51,6 @@ public static Bar getInstance() { return instance; } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -64,7 +59,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override @@ -129,11 +124,6 @@ public static InvalidStringValueForDefault1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -144,12 +134,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -162,12 +147,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -180,7 +160,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -199,11 +179,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -214,7 +189,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index ea93d08e724..3f0b96d61cd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -53,11 +53,6 @@ public static Ipv4Format1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index 8946e5f491a..60b9e0d6ce1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -53,11 +53,6 @@ public static Ipv6Format1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index a2b630be04f..a3252fe126f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -53,11 +53,6 @@ public static JsonPointerFormat1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index 4d6f07e21dc..e507d0ca31f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -53,11 +53,6 @@ public static MaximumValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index b8e684cb5be..cc84e386655 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -53,11 +53,6 @@ public static MaximumValidationWithUnsignedInteger1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index 0ced583aee0..91023998c22 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -53,11 +53,6 @@ public static MaxitemsValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index ecf584da152..199df22252b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -53,11 +53,6 @@ public static MaxlengthValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index f402908dc65..c6d74f69eee 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -53,11 +53,6 @@ public static Maxproperties0MeansTheObjectIsEmpty1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 0e19a2c4ce1..43e413dfdb1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -53,11 +53,6 @@ public static MaxpropertiesValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index 6a55016b4b7..22f33f41f43 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -53,11 +53,6 @@ public static MinimumValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 5e5ac29482e..3b390fa5829 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -53,11 +53,6 @@ public static MinimumValidationWithSignedInteger1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 2cb4816815b..40f87755f1f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -53,11 +53,6 @@ public static MinitemsValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 0bb3581a1ec..3b2ae524483 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -53,11 +53,6 @@ public static MinlengthValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 441a176a3fc..701ab9ddb11 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -53,11 +53,6 @@ public static MinpropertiesValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index 3cc81b4c145..cfee2fea787 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -53,11 +53,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -235,11 +215,6 @@ public static NestedAllofToCheckValidationSemantics1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -250,12 +225,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -268,12 +238,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -286,7 +251,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -305,11 +270,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -320,7 +280,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index b0031e1b2f0..1206f27e249 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -53,11 +53,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -235,11 +215,6 @@ public static NestedAnyofToCheckValidationSemantics1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -250,12 +225,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -268,12 +238,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -286,7 +251,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -305,11 +270,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -320,7 +280,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index 6d61bf77909..4f8369eaa06 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -53,11 +53,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -235,11 +215,6 @@ public static NestedOneofToCheckValidationSemantics1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -250,12 +225,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -268,12 +238,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -286,7 +251,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -305,11 +270,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -320,7 +280,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 1cae94fbc2d..b0aabf1a87e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -57,11 +57,6 @@ public static Not1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -72,12 +67,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -90,12 +80,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -108,7 +93,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -127,11 +112,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -142,7 +122,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index c9b08b5041c..2958fb29867 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -144,11 +144,6 @@ public static NotMoreComplexSchema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -159,12 +154,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -177,12 +167,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -195,7 +180,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -214,11 +199,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -229,7 +209,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java index 2cab2557e9f..5c795ba1272 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java @@ -49,11 +49,6 @@ public static NulCharactersInStrings1 getInstance() { return instance; } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -62,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index ebf691dd545..78d78957cdc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -101,11 +101,6 @@ public static ObjectPropertiesValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -116,12 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -134,12 +124,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -152,7 +137,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -171,11 +156,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -186,7 +166,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 68d1a805c9b..9736ff687fa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -51,11 +51,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -66,12 +61,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -84,12 +74,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -102,7 +87,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -121,11 +106,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -136,7 +116,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -234,11 +214,6 @@ public static Oneof1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -249,12 +224,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -267,12 +237,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -285,7 +250,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -304,11 +269,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -319,7 +279,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 88de982714f..4dc6b85b221 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -85,11 +85,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -100,12 +95,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -118,12 +108,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -136,7 +121,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -155,11 +140,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -170,7 +150,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -305,11 +285,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -320,12 +295,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -338,12 +308,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -356,7 +321,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -375,11 +340,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -390,7 +350,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -499,11 +459,6 @@ public static OneofComplexTypes1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -514,12 +469,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -532,12 +482,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -550,7 +495,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -569,11 +514,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -584,7 +524,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index 6f2fe2d23c4..59e5ff0af10 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -47,11 +47,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -62,12 +57,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -80,12 +70,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -98,7 +83,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -117,11 +102,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -132,7 +112,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -221,11 +201,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -236,12 +211,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -254,12 +224,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -272,7 +237,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -291,11 +256,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -306,7 +266,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -407,11 +367,6 @@ public static OneofWithBaseSchema1 getInstance() { return instance; } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -420,7 +375,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index ab1604b3338..278b988b5c4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -64,11 +64,6 @@ public static OneofWithEmptySchema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -79,12 +74,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -97,12 +87,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -115,7 +100,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -134,11 +119,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -149,7 +129,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index 75051e8e376..35051c68d72 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -82,11 +82,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -97,12 +92,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -115,12 +105,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -133,7 +118,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -152,11 +137,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -167,7 +147,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -302,11 +282,6 @@ public static Schema1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -317,12 +292,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -335,12 +305,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -353,7 +318,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -372,11 +337,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -387,7 +347,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 403ff1b0780..f1d677defcb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -56,11 +56,6 @@ public static PatternIsNotAnchored1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -71,12 +66,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -89,12 +79,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -107,7 +92,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -126,11 +111,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -141,7 +121,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index bff1dcfff09..df7238f3b50 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -56,11 +56,6 @@ public static PatternValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -71,12 +66,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -89,12 +79,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -107,7 +92,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -126,11 +111,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -141,7 +121,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index ee03cc129fe..af8ebc1d8ec 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -108,11 +108,6 @@ public static PropertiesWithEscapedCharacters1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -123,12 +118,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -141,12 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -159,7 +144,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -178,11 +163,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -193,7 +173,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 2d063228561..7a9a3b81c93 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -83,11 +83,6 @@ public static PropertyNamedRefThatIsNotAReference1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -98,12 +93,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -116,12 +106,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -134,7 +119,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -153,11 +138,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -168,7 +148,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index 2b10021e4c5..9a7e33fd2d5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -55,11 +55,6 @@ public static RefInAllof1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -70,12 +65,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -88,12 +78,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -106,7 +91,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -125,11 +110,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -140,7 +120,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index 4377e620872..6be2d15976e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -55,11 +55,6 @@ public static RefInAnyof1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -70,12 +65,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -88,12 +78,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -106,7 +91,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -125,11 +110,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -140,7 +120,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 2ef3f2e0f8d..785341cbdf6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -53,11 +53,6 @@ public static RefInNot1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 3014ef80640..3e0e698e904 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -55,11 +55,6 @@ public static RefInOneof1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -70,12 +65,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -88,12 +78,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -106,7 +91,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -125,11 +110,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -140,7 +120,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index ce5c4897c15..dc32fcfca67 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -85,11 +85,6 @@ public static RefInProperty1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -100,12 +95,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -118,12 +108,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -136,7 +121,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -155,11 +140,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -170,7 +150,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 6fe1687ad9f..586299734a7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -89,11 +89,6 @@ public static RequiredDefaultValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -104,12 +99,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -122,12 +112,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -140,7 +125,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -159,11 +144,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -174,7 +154,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index a682324e0d8..cf617360087 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -102,11 +102,6 @@ public static RequiredValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -117,12 +112,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -135,12 +125,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -153,7 +138,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -172,11 +157,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -187,7 +167,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 836dc8e0ed3..eaf56a05898 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -89,11 +89,6 @@ public static RequiredWithEmptyArray1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -104,12 +99,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -122,12 +112,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -140,7 +125,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -159,11 +144,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -174,7 +154,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 3ea174ad68c..84f097f3ed7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -88,11 +88,6 @@ public static RequiredWithEscapedCharacters1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -103,12 +98,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -121,12 +111,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -139,7 +124,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -158,11 +143,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -173,7 +153,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java index d7f60d57877..5472afa0ae5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java @@ -54,11 +54,6 @@ public static SimpleEnumValidation1 getInstance() { return instance; } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,7 +62,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index eca17d274e9..61e84d42a40 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -46,11 +46,6 @@ public static Alpha getInstance() { return instance; } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -59,7 +54,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index 4d993ebbe46..d0d0699240f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -53,11 +53,6 @@ public static UniqueitemsFalseValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index d031dcbf794..a22d340858f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -53,11 +53,6 @@ public static UniqueitemsValidation1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index 16948f3f4bc..d49b1a53f60 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -53,11 +53,6 @@ public static UriFormat1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index e22ca660423..d8a3c968865 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -53,11 +53,6 @@ public static UriReferenceFormat1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index c0e1191880b..34a55e959bf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -53,11 +53,6 @@ public static UriTemplateFormat1 getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -68,12 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -86,12 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -104,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -123,11 +108,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -138,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java index 334dde1536f..0a36c4527c2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java @@ -8,6 +8,5 @@ import java.util.Set; public interface BooleanSchemaValidator { - boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas); boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index d57eb6cac63..bb9f9c28a0c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -332,6 +332,22 @@ protected Object castToAllowedObjectTypes(Object arg, List pathToItem, S } } + public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, Object arg, ValidationMetadata validationMetadata, Set> pathSet) { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index cc5036004d9..fef38fe1670 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -8,6 +8,5 @@ import java.util.Set; public interface NullSchemaValidator { - Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas); Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java index 71df32c18da..1a601b35abf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java @@ -8,6 +8,5 @@ import java.util.Set; public interface NumberSchemaValidator { - Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas); Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java index 0466ad5e12c..d897f9670d7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java @@ -8,6 +8,5 @@ import java.util.Set; public interface StringSchemaValidator { - String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas); String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index ba8a5cb18a3..fc92d45d596 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -2,11 +2,6 @@ {{#each types}} {{#eq this "null"}} -@Override -public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; -} - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -15,7 +10,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } {{/eq}} {{#eq this "object"}} @@ -93,11 +88,6 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCas // bytes, {{else}} -@Override -public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; -} - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -106,17 +96,12 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } {{/eq}} {{/eq}} {{#eq this "integer"}} -@Override -public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; -} - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -125,7 +110,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -148,11 +133,6 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{/eq}} {{#eq this "number"}} -@Override -public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; -} - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -161,7 +141,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } {{#eq ../format null}} public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -223,11 +203,6 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{/eq}} {{#eq this "boolean"}} -@Override -public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; -} - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -236,17 +211,12 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } {{/eq}} {{/each}} {{else}} -@Override -public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; -} - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -257,12 +227,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); -} - -@Override -public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -275,12 +240,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); -} - -@Override -public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return castArg; } @Override @@ -293,7 +253,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -312,11 +272,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } -@Override -public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; -} - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -327,7 +282,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs index b199c13df24..d0bc5ce45ab 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs @@ -8,6 +8,5 @@ import java.util.List; import java.util.Set; public interface BooleanSchemaValidator { - boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas); boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index 4ffe1388136..e2e51895198 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -332,6 +332,22 @@ public abstract class JsonSchema { } } + public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, Object arg, ValidationMetadata validationMetadata, Set> pathSet) { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs index 722da16fa2c..bf767377855 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs @@ -8,6 +8,5 @@ import java.util.List; import java.util.Set; public interface NullSchemaValidator { - Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas); Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs index 855144d4981..121d75d0358 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs @@ -8,6 +8,5 @@ import java.util.List; import java.util.Set; public interface NumberSchemaValidator { - Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas); Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs index 4298f89f728..9e44d146b5d 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs @@ -8,6 +8,5 @@ import java.util.List; import java.util.Set; public interface StringSchemaValidator { - String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas); String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file From 2f71d5101663cefc472b44ef9f1cdb1bc81294fb Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 17 Dec 2023 21:51:03 -0800 Subject: [PATCH 09/16] Has casting return list and map wildcard types --- ...rtiesAllowsASchemaWhichShouldValidate.java | 8 +- ...ditionalpropertiesAreAllowedByDefault.java | 35 ++-- .../AdditionalpropertiesCanExistByItself.java | 8 +- ...lpropertiesShouldNotLookInApplicators.java | 70 +++++--- .../client/components/schemas/Allof.java | 112 ++++++++---- .../schemas/AllofCombinedWithAnyofOneof.java | 168 +++++++++++++----- .../components/schemas/AllofSimpleTypes.java | 126 +++++++++---- .../schemas/AllofWithBaseSchema.java | 105 +++++++---- .../schemas/AllofWithOneEmptySchema.java | 42 +++-- .../schemas/AllofWithTheFirstEmptySchema.java | 42 +++-- .../schemas/AllofWithTheLastEmptySchema.java | 42 +++-- .../schemas/AllofWithTwoEmptySchemas.java | 42 +++-- .../client/components/schemas/Anyof.java | 84 ++++++--- .../components/schemas/AnyofComplexTypes.java | 112 ++++++++---- .../schemas/AnyofWithBaseSchema.java | 84 ++++++--- .../schemas/AnyofWithOneEmptySchema.java | 42 +++-- .../schemas/ArrayTypeMatchesArrays.java | 8 +- .../client/components/schemas/ByInt.java | 42 +++-- .../client/components/schemas/ByNumber.java | 42 +++-- .../components/schemas/BySmallNumber.java | 42 +++-- .../components/schemas/DateTimeFormat.java | 42 +++-- .../components/schemas/EmailFormat.java | 42 +++-- .../components/schemas/EnumsInProperties.java | 8 +- .../components/schemas/ForbiddenProperty.java | 35 ++-- .../components/schemas/HostnameFormat.java | 42 +++-- .../schemas/InvalidStringValueForDefault.java | 35 ++-- .../client/components/schemas/Ipv4Format.java | 42 +++-- .../client/components/schemas/Ipv6Format.java | 42 +++-- .../components/schemas/JsonPointerFormat.java | 42 +++-- .../components/schemas/MaximumValidation.java | 42 +++-- .../MaximumValidationWithUnsignedInteger.java | 42 +++-- .../schemas/MaxitemsValidation.java | 42 +++-- .../schemas/MaxlengthValidation.java | 42 +++-- .../Maxproperties0MeansTheObjectIsEmpty.java | 42 +++-- .../schemas/MaxpropertiesValidation.java | 42 +++-- .../components/schemas/MinimumValidation.java | 42 +++-- .../MinimumValidationWithSignedInteger.java | 42 +++-- .../schemas/MinitemsValidation.java | 42 +++-- .../schemas/MinlengthValidation.java | 42 +++-- .../schemas/MinpropertiesValidation.java | 42 +++-- ...NestedAllofToCheckValidationSemantics.java | 84 ++++++--- ...NestedAnyofToCheckValidationSemantics.java | 84 ++++++--- .../components/schemas/NestedItems.java | 32 ++-- ...NestedOneofToCheckValidationSemantics.java | 84 ++++++--- .../client/components/schemas/Not.java | 42 +++-- .../schemas/NotMoreComplexSchema.java | 50 ++++-- .../schemas/ObjectPropertiesValidation.java | 35 ++-- .../client/components/schemas/Oneof.java | 84 ++++++--- .../components/schemas/OneofComplexTypes.java | 112 ++++++++---- .../schemas/OneofWithBaseSchema.java | 84 ++++++--- .../schemas/OneofWithEmptySchema.java | 42 +++-- .../components/schemas/OneofWithRequired.java | 88 +++++---- .../schemas/PatternIsNotAnchored.java | 42 +++-- .../components/schemas/PatternValidation.java | 42 +++-- .../PropertiesWithEscapedCharacters.java | 35 ++-- .../PropertyNamedRefThatIsNotAReference.java | 35 ++-- .../schemas/RefInAdditionalproperties.java | 8 +- .../client/components/schemas/RefInAllof.java | 42 +++-- .../client/components/schemas/RefInAnyof.java | 42 +++-- .../client/components/schemas/RefInItems.java | 8 +- .../client/components/schemas/RefInNot.java | 42 +++-- .../client/components/schemas/RefInOneof.java | 42 +++-- .../components/schemas/RefInProperty.java | 35 ++-- .../schemas/RequiredDefaultValidation.java | 35 ++-- .../schemas/RequiredValidation.java | 35 ++-- .../schemas/RequiredWithEmptyArray.java | 35 ++-- .../RequiredWithEscapedCharacters.java | 35 ++-- ...esNotDoAnythingIfThePropertyIsMissing.java | 8 +- .../schemas/UniqueitemsFalseValidation.java | 42 +++-- .../schemas/UniqueitemsValidation.java | 42 +++-- .../client/components/schemas/UriFormat.java | 42 +++-- .../schemas/UriReferenceFormat.java | 42 +++-- .../components/schemas/UriTemplateFormat.java | 42 +++-- .../client/schemas/validation/JsonSchema.java | 10 +- .../validation/ListSchemaValidator.java | 2 +- .../validation/MapSchemaValidator.java | 2 +- .../SchemaClass/_validate_implementor.hbs | 76 ++++---- .../schemas/validation/JsonSchema.hbs | 10 +- .../validation/ListSchemaValidator.hbs | 2 +- .../schemas/validation/MapSchemaValidator.hbs | 2 +- 80 files changed, 2600 insertions(+), 1104 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index d9ae9be4f00..4d06e67ed88 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -96,10 +96,10 @@ public static AdditionalpropertiesAllowsASchemaWhichShouldValidate1 getInstance( return instance; } - public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -115,7 +115,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Fr public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index 1e952cd0b96..40bf43aedeb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -181,33 +181,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -219,7 +228,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map a Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index 926a34502ec..df49a0da293 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -69,10 +69,10 @@ public static AdditionalpropertiesCanExistByItself1 getInstance() { return instance; } - public AdditionalpropertiesCanExistByItselfMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -88,7 +88,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(FrozenMap arg, public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 39e9c75e070..56c9d5ef659 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -168,33 +168,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -206,7 +215,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -362,33 +371,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Boolean castValue = (Boolean) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Boolean castValue = (Boolean) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -400,7 +418,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index 4e8bbf79342..ed6a29a5490 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -166,33 +166,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -204,7 +213,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -366,33 +375,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -404,7 +422,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -540,26 +558,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -567,7 +605,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index 1a5902983f9..025b2d3be57 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -129,26 +129,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -156,7 +176,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -283,26 +303,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -310,7 +350,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -437,26 +477,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -464,7 +524,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -605,26 +665,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -632,7 +712,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index 9a3439a6ebe..f75d9f66370 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -128,26 +128,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -155,7 +175,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -282,26 +302,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -309,7 +349,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -445,26 +485,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -472,7 +532,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index 83f05672c95..aca7faa9159 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -167,33 +167,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -205,7 +214,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -367,33 +376,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -405,7 +423,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -577,33 +595,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public AllofWithBaseSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -615,7 +642,7 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfigurat Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 3dcd6c3783d..034352a4fa5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -140,26 +140,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -167,7 +187,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 6a3eeebe26e..05af93011c5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -145,26 +145,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -172,7 +192,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index a8ebc292f1d..9109c5ecb8b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -145,26 +145,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -172,7 +192,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index aabad3de83d..fa738289031 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -144,26 +144,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -171,7 +191,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index a544d0541c0..0285f339055 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -132,26 +132,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -159,7 +179,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -295,26 +315,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -322,7 +362,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index d0dcf57b71e..a08c0b15909 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -166,33 +166,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -204,7 +213,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -366,33 +375,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -404,7 +422,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -540,26 +558,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -567,7 +605,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index d5774f464af..b3ee6b0c837 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -128,26 +128,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -155,7 +175,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -282,26 +302,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -309,7 +349,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 496d7c5a707..7c417284b1f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -145,26 +145,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -172,7 +192,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 452008541b7..8cda260ad67 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -64,14 +64,14 @@ public static ArrayTypeMatchesArrays1 getInstance() { } @Override - public ArrayTypeMatchesArraysList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayTypeMatchesArraysList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -83,7 +83,7 @@ public ArrayTypeMatchesArraysList getNewInstance(FrozenList arg, List public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index f88a12ad34c..a5908cf6e48 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -135,26 +135,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -162,7 +182,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index 9d8e92fe3aa..43360c47cc7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -135,26 +135,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -162,7 +182,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index 626455a456d..8dc0e138736 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -135,26 +135,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -162,7 +182,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index f6737baa268..9025cd60389 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index f30950863e9..c9e3c736319 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 7d55e92ee38..0e9e97ebc1c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -171,10 +171,10 @@ public static EnumsInProperties1 getInstance() { return instance; } - public EnumsInPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public EnumsInPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -190,7 +190,7 @@ public EnumsInPropertiesMap getNewInstance(FrozenMap arg, List pathTo public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 8a49a4b973e..cd2912f9d1c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -172,33 +172,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public ForbiddenPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ForbiddenPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -210,7 +219,7 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguratio Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index 295e1283911..195ad82c83a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index d599993deb6..a2b46d06444 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -205,33 +205,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public InvalidStringValueForDefaultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public InvalidStringValueForDefaultMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -243,7 +252,7 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaC Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index 3f0b96d61cd..e3a362deb07 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index 60b9e0d6ce1..ad7f049a0a8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index a3252fe126f..eeb2a4818bb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index e507d0ca31f..b2b6428a2e9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index cc84e386655..97e9ec06b59 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index 91023998c22..39dd4a4c859 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 199df22252b..1f6f33e97e3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index c6d74f69eee..ef6be6ae155 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 43e413dfdb1..1fa5138a7aa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index 22f33f41f43..5fe38594857 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 3b390fa5829..9ce18700f20 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 40f87755f1f..220065183e5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 3b2ae524483..8dd8798269b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 701ab9ddb11..9772341d5f2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index cfee2fea787..528c682ceb7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -296,26 +316,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -323,7 +363,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index 1206f27e249..5fb2da06e4a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -296,26 +316,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -323,7 +363,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index e260c3501ca..b897080bcdd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -58,14 +58,14 @@ public static Items2 getInstance() { } @Override - public ItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Number castItem = (Number) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Number castItem = (Number) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -77,7 +77,7 @@ public ItemsList getNewInstance(FrozenList arg, List pathToItem, Path public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -126,14 +126,14 @@ public static Items1 getInstance() { } @Override - public ItemsList1 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - ItemsList castItem = (ItemsList) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + ItemsList castItem = (ItemsList) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -145,7 +145,7 @@ public ItemsList1 getNewInstance(FrozenList arg, List pathToItem, Pat public ItemsList1 validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -194,14 +194,14 @@ public static Items getInstance() { } @Override - public ItemsList2 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ItemsList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - ItemsList1 castItem = (ItemsList1) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + ItemsList1 castItem = (ItemsList1) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -213,7 +213,7 @@ public ItemsList2 getNewInstance(FrozenList arg, List pathToItem, Pat public ItemsList2 validate(List>> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -268,14 +268,14 @@ public static NestedItems1 getInstance() { } @Override - public NestedItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public NestedItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - ItemsList2 castItem = (ItemsList2) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + ItemsList2 castItem = (ItemsList2) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -287,7 +287,7 @@ public NestedItemsList getNewInstance(FrozenList arg, List pathToItem public NestedItemsList validate(List>>> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index 4f8369eaa06..e5b1b81bb31 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -296,26 +316,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -323,7 +363,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index b0aabf1a87e..459a0d25c32 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -138,26 +138,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -165,7 +185,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 2958fb29867..45c5a30c426 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -84,10 +84,10 @@ public static Not getInstance() { return instance; } - public NotMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NotMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -103,7 +103,7 @@ public NotMap getNewInstance(FrozenMap arg, List pathToItem, PathToSc public NotMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -225,26 +225,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -252,7 +272,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index 78d78957cdc..34cbc2e91e7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -182,33 +182,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public ObjectPropertiesValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectPropertiesValidationMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -220,7 +229,7 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaCon Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 9736ff687fa..33e65ae6f25 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -132,26 +132,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -159,7 +179,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -295,26 +315,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -322,7 +362,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 4dc6b85b221..831a0515c3f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -166,33 +166,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -204,7 +213,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -366,33 +375,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -404,7 +422,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -540,26 +558,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -567,7 +605,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index 59e5ff0af10..54baf9236b3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -128,26 +128,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -155,7 +175,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -282,26 +302,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -309,7 +349,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 278b988b5c4..25b4ccf1cdc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -145,26 +145,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -172,7 +192,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index 35051c68d72..29c175d2d1a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -163,33 +163,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -201,7 +210,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -363,33 +372,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -401,7 +419,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -457,16 +475,26 @@ public static OneofWithRequired1 getInstance() { return instance; } - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index f1d677defcb..9f3bb83495c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -137,26 +137,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -164,7 +184,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index df7238f3b50..8752385c916 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -137,26 +137,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -164,7 +184,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index af8ebc1d8ec..198766ccfa4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -189,33 +189,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public PropertiesWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -227,7 +236,7 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, Sche Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 7a9a3b81c93..6cda912fad1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -164,33 +164,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -202,7 +211,7 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index e3312b3bd56..8cc56630302 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -65,10 +65,10 @@ public static RefInAdditionalproperties1 getInstance() { return instance; } - public RefInAdditionalpropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RefInAdditionalpropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -84,7 +84,7 @@ public RefInAdditionalpropertiesMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index 9a7e33fd2d5..964fafbdf03 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -136,26 +136,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -163,7 +183,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index 6be2d15976e..8a4502ee80f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -136,26 +136,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -163,7 +183,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index 2291255aa12..faae283baa3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -60,14 +60,14 @@ public static RefInItems1 getInstance() { } @Override - public RefInItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public RefInItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -79,7 +79,7 @@ public RefInItemsList getNewInstance(FrozenList arg, List pathToItem, public RefInItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 785341cbdf6..78470b5c0c4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 3e0e698e904..e6aefe7d612 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -136,26 +136,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -163,7 +183,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index dc32fcfca67..e1a4120d2c0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -166,33 +166,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public RefInPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RefInPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -204,7 +213,7 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration co Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 586299734a7..87c4794048e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -170,33 +170,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public RequiredDefaultValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RequiredDefaultValidationMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -208,7 +217,7 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConf Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index cf617360087..135504e0e17 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -183,33 +183,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public RequiredValidationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RequiredValidationMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -221,7 +230,7 @@ public RequiredValidationMap validate(Map arg, SchemaConfigurati Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index eaf56a05898..096825a1437 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -170,33 +170,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public RequiredWithEmptyArrayMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RequiredWithEmptyArrayMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -208,7 +217,7 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfigu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 84f097f3ed7..c64f2e3e6f6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -169,33 +169,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public RequiredWithEscapedCharactersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -207,7 +216,7 @@ public RequiredWithEscapedCharactersMap validate(Map arg, Schema Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index 61e84d42a40..d54aac0242f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -135,10 +135,10 @@ public static TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 getInsta return instance; } - public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -154,7 +154,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index d0d0699240f..ce1eed6cf8c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index a22d340858f..721b60b8094 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index d49b1a53f60..c2dc1acc7f5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index d8a3c968865..da0df31b499 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 34a55e959bf..0afa4e5ce20 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -134,26 +134,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -161,7 +181,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index bb9f9c28a0c..87ee535a81b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -272,7 +272,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; @@ -283,21 +283,21 @@ protected FrozenList castToAllowedTypes(List arg, List pathToItem, argFixed.add(fixedVal); i += 1; } - return new FrozenList<>(argFixed); + return argFixed; } - protected FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { String key = (String) entry.getKey(); - Object val = entry.getValue(); + Object val = arg.get(entry.getKey()); List newPathToItem = new ArrayList<>(pathToItem); newPathToItem.add(key); Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); argFixed.put(key, fixedVal); } - return new FrozenMap<>(argFixed); + return argFixed; } protected Object castToAllowedObjectTypes(Object arg, List pathToItem, Set> pathSet) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index 29a591d4240..5f0dd278333 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -8,6 +8,6 @@ import java.util.Set; public interface ListSchemaValidator { - OutType getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(List arg, List pathToItem, 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/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 417892e4649..ec1abf1b1ae 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -9,6 +9,6 @@ import java.util.Set; public interface MapSchemaValidator { - OutType getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index fc92d45d596..9cbfd814bd3 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -15,11 +15,10 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat {{/eq}} {{#eq this "object"}} - {{#if ../mapOutputJsonPathPiece}} -public {{../mapOutputJsonPathPiece.camelCase}} getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -28,20 +27,18 @@ public {{../mapOutputJsonPathPiece.camelCase}} getNewInstance(FrozenMap arg, properties.put(propertyName, castValue); } FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castProperties = new FrozenMap<>(properties); + {{#if ../mapOutputJsonPathPiece}} return new {{mapOutputJsonPathPiece.camelCase}}(castProperties); -} {{else}} -@Override -public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; -} + return castProperties; {{/if}} +} @Override public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap{{/if}} validate(Map src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -52,22 +49,22 @@ public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.camelCase}}{ {{#eq this "array"}} @Override -public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - {{#if ../arrayOutputJsonPathPiece}} - ArrayList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> items = new ArrayList<>(); +public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - {{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}} castItem = ({{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + {{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} castItem = ({{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } - FrozenList<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> newInstanceItems = new FrozenList<>(items); + FrozenList<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> newInstanceItems = new FrozenList<>(items); + {{#if ../arrayOutputJsonPathPiece}} return new {{../arrayOutputJsonPathPiece.camelCase}}(newInstanceItems); {{else}} - return arg; + return newInstanceItems; {{/if}} } @@ -75,7 +72,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCas public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} validate(List<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -298,29 +295,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override -public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; +public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + {{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}} castItem = ({{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> newInstanceItems = new FrozenList<>(items); + {{#if arrayOutputJsonPathPiece}} + return new {{arrayOutputJsonPathPiece.camelCase}}(newInstanceItems); + {{else}} + return newInstanceItems; + {{/if}} } @Override -public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.camelCase}}{{else}}FrozenList<{{#with ../items}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} validate(List<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override -public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - {{#if mapOutputJsonPathPiece}} +public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -329,10 +338,11 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else} properties.put(propertyName, castValue); } FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castProperties = new FrozenMap<>(properties); + {{#if ../mapOutputJsonPathPiece}} return new {{mapOutputJsonPathPiece.camelCase}}(castProperties); - {{else}} - return (FrozenMap) arg; - {{/if}} + {{else}} + return castProperties; + {{/if}} } @Override @@ -340,7 +350,7 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.camelCase}}{{else} Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index e2e51895198..cfd25b75bab 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -272,7 +272,7 @@ public abstract class JsonSchema { return arg; } - protected FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; @@ -283,21 +283,21 @@ public abstract class JsonSchema { argFixed.add(fixedVal); i += 1; } - return new FrozenList<>(argFixed); + return argFixed; } - protected FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { String key = (String) entry.getKey(); - Object val = entry.getValue(); + Object val = arg.get(entry.getKey()); List newPathToItem = new ArrayList<>(pathToItem); newPathToItem.add(key); Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); argFixed.put(key, fixedVal); } - return new FrozenMap<>(argFixed); + return argFixed; } protected Object castToAllowedObjectTypes(Object arg, List pathToItem, Set> pathSet) { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs index f6fe37ad93e..8d6df10e2ec 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs @@ -8,6 +8,6 @@ import java.util.List; import java.util.Set; public interface ListSchemaValidator { - OutType getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs index 9ae7b7d65f6..99a1c411513 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs @@ -9,6 +9,6 @@ import java.util.Map; import java.util.Set; public interface MapSchemaValidator { - OutType getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file From 8db5d1bb7355b7765a6ffc83de92adb5ba11250f Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 17 Dec 2023 22:03:26 -0800 Subject: [PATCH 10/16] Removes unchecked casts in getNewInstance --- ...rtiesAllowsASchemaWhichShouldValidate.java | 5 +-- ...ditionalpropertiesAreAllowedByDefault.java | 10 ++--- .../AdditionalpropertiesCanExistByItself.java | 5 +-- ...lpropertiesShouldNotLookInApplicators.java | 20 ++++------ .../client/components/schemas/Allof.java | 30 ++++++-------- .../schemas/AllofCombinedWithAnyofOneof.java | 40 ++++++++----------- .../components/schemas/AllofSimpleTypes.java | 30 ++++++-------- .../schemas/AllofWithBaseSchema.java | 30 ++++++-------- .../schemas/AllofWithOneEmptySchema.java | 10 ++--- .../schemas/AllofWithTheFirstEmptySchema.java | 10 ++--- .../schemas/AllofWithTheLastEmptySchema.java | 10 ++--- .../schemas/AllofWithTwoEmptySchemas.java | 10 ++--- .../client/components/schemas/Anyof.java | 20 ++++------ .../components/schemas/AnyofComplexTypes.java | 30 ++++++-------- .../schemas/AnyofWithBaseSchema.java | 20 ++++------ .../schemas/AnyofWithOneEmptySchema.java | 10 ++--- .../schemas/ArrayTypeMatchesArrays.java | 5 +-- .../client/components/schemas/ByInt.java | 10 ++--- .../client/components/schemas/ByNumber.java | 10 ++--- .../components/schemas/BySmallNumber.java | 10 ++--- .../components/schemas/DateTimeFormat.java | 10 ++--- .../components/schemas/EmailFormat.java | 10 ++--- .../components/schemas/EnumsInProperties.java | 5 +-- .../components/schemas/ForbiddenProperty.java | 10 ++--- .../components/schemas/HostnameFormat.java | 10 ++--- .../schemas/InvalidStringValueForDefault.java | 10 ++--- .../client/components/schemas/Ipv4Format.java | 10 ++--- .../client/components/schemas/Ipv6Format.java | 10 ++--- .../components/schemas/JsonPointerFormat.java | 10 ++--- .../components/schemas/MaximumValidation.java | 10 ++--- .../MaximumValidationWithUnsignedInteger.java | 10 ++--- .../schemas/MaxitemsValidation.java | 10 ++--- .../schemas/MaxlengthValidation.java | 10 ++--- .../Maxproperties0MeansTheObjectIsEmpty.java | 10 ++--- .../schemas/MaxpropertiesValidation.java | 10 ++--- .../components/schemas/MinimumValidation.java | 10 ++--- .../MinimumValidationWithSignedInteger.java | 10 ++--- .../schemas/MinitemsValidation.java | 10 ++--- .../schemas/MinlengthValidation.java | 10 ++--- .../schemas/MinpropertiesValidation.java | 10 ++--- ...NestedAllofToCheckValidationSemantics.java | 20 ++++------ ...NestedAnyofToCheckValidationSemantics.java | 20 ++++------ .../components/schemas/NestedItems.java | 20 ++++------ ...NestedOneofToCheckValidationSemantics.java | 20 ++++------ .../client/components/schemas/Not.java | 10 ++--- .../schemas/NotMoreComplexSchema.java | 15 +++---- .../schemas/ObjectPropertiesValidation.java | 10 ++--- .../client/components/schemas/Oneof.java | 20 ++++------ .../components/schemas/OneofComplexTypes.java | 30 ++++++-------- .../schemas/OneofWithBaseSchema.java | 20 ++++------ .../schemas/OneofWithEmptySchema.java | 10 ++--- .../components/schemas/OneofWithRequired.java | 25 +++++------- .../schemas/PatternIsNotAnchored.java | 10 ++--- .../components/schemas/PatternValidation.java | 10 ++--- .../PropertiesWithEscapedCharacters.java | 10 ++--- .../PropertyNamedRefThatIsNotAReference.java | 10 ++--- .../schemas/RefInAdditionalproperties.java | 5 +-- .../client/components/schemas/RefInAllof.java | 10 ++--- .../client/components/schemas/RefInAnyof.java | 10 ++--- .../client/components/schemas/RefInItems.java | 5 +-- .../client/components/schemas/RefInNot.java | 10 ++--- .../client/components/schemas/RefInOneof.java | 10 ++--- .../components/schemas/RefInProperty.java | 10 ++--- .../schemas/RequiredDefaultValidation.java | 10 ++--- .../schemas/RequiredValidation.java | 10 ++--- .../schemas/RequiredWithEmptyArray.java | 10 ++--- .../RequiredWithEscapedCharacters.java | 10 ++--- ...esNotDoAnythingIfThePropertyIsMissing.java | 5 +-- .../schemas/UniqueitemsFalseValidation.java | 10 ++--- .../schemas/UniqueitemsValidation.java | 10 ++--- .../client/components/schemas/UriFormat.java | 10 ++--- .../schemas/UriReferenceFormat.java | 10 ++--- .../components/schemas/UriTemplateFormat.java | 10 ++--- .../_castToAllowedTypesObject_implementor.hbs | 20 ++++------ 74 files changed, 382 insertions(+), 573 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index 4d06e67ed88..1b7d681e111 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -125,9 +125,8 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index 40bf43aedeb..49cf05b62e5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -247,12 +247,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index df49a0da293..a59fa35ba7b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -98,9 +98,8 @@ public AdditionalpropertiesCanExistByItselfMap validate(Map arg @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 56c9d5ef659..c4a1aed71c5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -234,12 +234,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -437,12 +435,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index ed6a29a5490..e244f932d0c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -232,12 +232,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -441,12 +439,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -624,12 +620,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index 025b2d3be57..fdbf62e7943 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -195,12 +195,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -369,12 +367,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -543,12 +539,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -731,12 +725,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index f75d9f66370..214ecc76174 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -194,12 +194,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -368,12 +366,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -551,12 +547,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index aca7faa9159..49f64e655fc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -233,12 +233,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -442,12 +440,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -661,12 +657,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 034352a4fa5..9e4f08c72ac 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -206,12 +206,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 05af93011c5..6faaa6f4304 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -211,12 +211,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 9109c5ecb8b..ed4b7855131 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -211,12 +211,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index fa738289031..53333e35424 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -210,12 +210,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 0285f339055..d1301402d58 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -198,12 +198,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -381,12 +379,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index a08c0b15909..cc6878208fa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -232,12 +232,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -441,12 +439,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -624,12 +620,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index b3ee6b0c837..358a9056e8c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -194,12 +194,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -368,12 +366,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 7c417284b1f..1a4faa1925b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -211,12 +211,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 8cda260ad67..0f4a2671c1b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -92,9 +92,8 @@ public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index a5908cf6e48..511daf179f6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -201,12 +201,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index 43360c47cc7..f0a80c4f66f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -201,12 +201,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index 8dc0e138736..c60b68fc87b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -201,12 +201,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index 9025cd60389..35bd312dff9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index c9e3c736319..3dea7749d3d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 0e9e97ebc1c..44239dc99c2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -200,9 +200,8 @@ public EnumsInPropertiesMap validate(Map arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index cd2912f9d1c..bf392f66f1a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -238,12 +238,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index 195ad82c83a..8904eff3aaf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index a2b46d06444..afefb6f61c4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -271,12 +271,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index e3a362deb07..f9cd2be3ea8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index ad7f049a0a8..6f6208b934c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index eeb2a4818bb..4be5571cfb3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index b2b6428a2e9..48f676eae8b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 97e9ec06b59..76a997d840a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index 39dd4a4c859..fc6ef26854b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 1f6f33e97e3..fc2031708c6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index ef6be6ae155..c623e6b3eeb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 1fa5138a7aa..539a61cc42f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index 5fe38594857..c0483afda16 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 9ce18700f20..18a57d7c6e9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 220065183e5..89f0441e1fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 8dd8798269b..fbc5a50e6cc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 9772341d5f2..cf6adb050b4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index 528c682ceb7..2d557f62fe1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -382,12 +380,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index 5fb2da06e4a..f44bf75f709 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -382,12 +380,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index b897080bcdd..540f8d5955d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -86,9 +86,8 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) t @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -154,9 +153,8 @@ public ItemsList1 validate(List> arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -222,9 +220,8 @@ public ItemsList2 validate(List>> arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList>> castArg = (FrozenList>>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -296,9 +293,8 @@ public NestedItemsList validate(List>>> arg, SchemaConfig @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList>>> castArg = (FrozenList>>>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index e5b1b81bb31..d0869bd1a86 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -382,12 +380,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 459a0d25c32..dd2794c0ad4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -204,12 +204,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 45c5a30c426..19ba44beae0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -113,9 +113,8 @@ public NotMap validate(Map arg, SchemaConfiguration configuratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -291,12 +290,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index 34cbc2e91e7..edf544f68cd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -248,12 +248,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 33e65ae6f25..b02b2bae7ce 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -198,12 +198,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -381,12 +379,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 831a0515c3f..1ca05670b13 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -232,12 +232,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -441,12 +439,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -624,12 +620,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index 54baf9236b3..e8e2c7a8d29 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -194,12 +194,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -368,12 +366,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 25b4ccf1cdc..b34c1977634 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -211,12 +211,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index 29c175d2d1a..97956fea66c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -229,12 +229,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -438,12 +436,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -504,9 +500,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 9f3bb83495c..1658b52d7be 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -203,12 +203,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 8752385c916..4434bd862c0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -203,12 +203,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index 198766ccfa4..6e1cc12cc52 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -255,12 +255,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 6cda912fad1..d6c2b009ea8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -230,12 +230,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index 8cc56630302..6389dc6441c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -94,9 +94,8 @@ public RefInAdditionalpropertiesMap validate(Map arg, SchemaConf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index 964fafbdf03..b2f9c5b8179 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -202,12 +202,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index 8a4502ee80f..c563648799e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -202,12 +202,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index faae283baa3..41d409e2f80 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -88,9 +88,8 @@ public RefInItemsList validate(List arg, SchemaConfiguration configurati @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 78470b5c0c4..f25a5e39340 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index e6aefe7d612..a859bb7fc32 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -202,12 +202,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index e1a4120d2c0..eb810091004 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -232,12 +232,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 87c4794048e..159e42d35fa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -236,12 +236,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index 135504e0e17..74462572f50 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -249,12 +249,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 096825a1437..97d895d9c78 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -236,12 +236,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index c64f2e3e6f6..fdd7ebe5839 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -235,12 +235,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index d54aac0242f..0600ee43a2b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -164,9 +164,8 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map< @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index ce1eed6cf8c..6c79ad91906 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index 721b60b8094..b847057b0a8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index c2dc1acc7f5..7b14c215f5c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index da0df31b499..6633fb8d52b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 0afa4e5ce20..4f844b766b0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -200,12 +200,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor.hbs index 857e4177248..da5fdf17937 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor.hbs @@ -4,9 +4,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM {{#if types}} {{#each types}} {{#if @first}} - if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof FrozenList{{/eq}}{{#eq this "object"}}instanceof FrozenMap{{/eq}}) { + if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { {{else}} - } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof FrozenList{{/eq}}{{#eq this "object"}}instanceof FrozenMap{{/eq}}) { + } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}instanceof Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}instanceof Number{{/or}}{{#eq this "string" }}instanceof String{{/eq}}{{#eq this "array"}}instanceof List{{/eq}}{{#eq this "object"}}instanceof Map{{/eq}}) { {{/if}} {{#eq this "null"}} return getNewInstance((Void) null, pathToItem, pathToSchemas); @@ -22,12 +22,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((String) arg, pathToItem, pathToSchemas); {{/eq}} {{#eq this "array"}} - @SuppressWarnings("unchecked") FrozenList<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castArg = (FrozenList<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + return getNewInstance((List) castArg, pathToItem, pathToSchemas); {{/eq}} {{#eq this "object"}} - @SuppressWarnings("unchecked") FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castArg = (FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); {{/eq}} {{#if @last}} } @@ -43,12 +41,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castArg = (FrozenList<{{#with items}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}> castArg = (FrozenMap<{{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_cast_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Object{{/with}}>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) castArg, pathToItem, pathToSchemas); } {{/if}} throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); From 05ecb1750508b7ac31316e4b11e20bb77d34e55e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 18 Dec 2023 11:34:09 -0800 Subject: [PATCH 11/16] Removes unchecked casts in getnewinstance with object input --- .../client/schemas/AnyTypeJsonSchema.java | 63 +++++++------ .../client/schemas/NotAnyTypeJsonSchema.java | 90 +++++++++++++------ .../validation/UnsetAnyTypeJsonSchema.java | 90 ++++++++++++------- .../packagename/schemas/AnyTypeJsonSchema.hbs | 65 +++++++------- .../schemas/NotAnyTypeJsonSchema.hbs | 90 +++++++++++++------ .../validation/UnsetAnyTypeJsonSchema.hbs | 86 +++++++++++------- 6 files changed, 301 insertions(+), 183 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 46043afc6da..4b8681051a9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -19,6 +19,7 @@ import java.time.LocalDate; import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; @@ -42,11 +43,6 @@ public static AnyTypeJsonSchema getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -60,11 +56,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -78,11 +69,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -112,11 +98,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -143,8 +124,18 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -152,7 +143,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -161,8 +152,18 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -170,7 +171,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -189,12 +190,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index 42d1784fca0..86ff72eb5b9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -17,6 +17,9 @@ import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; @@ -24,6 +27,7 @@ import java.util.Set; import java.util.Map; import java.util.Objects; +import java.util.UUID; public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static NotAnyTypeJsonSchema instance; @@ -41,10 +45,7 @@ public static NotAnyTypeJsonSchema getInstance() { return instance; } - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - + @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); @@ -57,11 +58,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -75,11 +71,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -93,9 +84,20 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public int validate(int arg, SchemaConfiguration configuration) { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) { + return (double) validate((Number) arg, configuration); } @Override @@ -111,9 +113,31 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -121,7 +145,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -130,8 +154,18 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -139,7 +173,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -158,12 +192,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 1427e4da9e0..ee54fbd1a5c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -5,6 +5,9 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; @@ -12,6 +15,7 @@ import java.util.Set; import java.util.Map; import java.util.Objects; +import java.util.UUID; public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static UnsetAnyTypeJsonSchema instance; @@ -27,11 +31,6 @@ public static UnsetAnyTypeJsonSchema getInstance() { return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -45,11 +44,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -63,11 +57,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -81,9 +70,20 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public int validate(int arg, SchemaConfiguration configuration) { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) { + return (double) validate((Number) arg, configuration); } @Override @@ -99,9 +99,31 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -109,7 +131,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -118,8 +140,18 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -127,7 +159,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -146,12 +178,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs index df0154a62a3..0f0f10bbdec 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs @@ -19,6 +19,7 @@ import {{{packageName}}}.schemas.validation.ValidationMetadata; import java.time.LocalDate; import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; @@ -42,11 +43,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -60,11 +56,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -78,11 +69,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -112,11 +98,6 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return (double) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -143,8 +124,18 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -152,7 +143,7 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -161,8 +152,18 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -170,7 +171,7 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -189,13 +190,11 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } -} +} \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs index 9d863421b24..7da532b7e86 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -17,6 +17,9 @@ import {{{packageName}}}.schemas.validation.ListSchemaValidator; import {{{packageName}}}.schemas.validation.MapSchemaValidator; import {{{packageName}}}.schemas.validation.ValidationMetadata; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; @@ -24,6 +27,7 @@ import java.util.LinkedHashSet; import java.util.Set; import java.util.Map; import java.util.Objects; +import java.util.UUID; public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static NotAnyTypeJsonSchema instance; @@ -41,10 +45,7 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return instance; } - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - + @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); @@ -57,11 +58,6 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -75,11 +71,6 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -93,9 +84,20 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public int validate(int arg, SchemaConfiguration configuration) { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) { + return (double) validate((Number) arg, configuration); } @Override @@ -111,9 +113,31 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -121,7 +145,7 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -130,8 +154,18 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -139,7 +173,7 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -158,12 +192,10 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index 1bcf8f2e589..b4adbc16075 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -27,11 +27,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return instance; } - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -45,11 +40,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -63,11 +53,6 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -81,9 +66,20 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public int validate(int arg, SchemaConfiguration configuration) { + return (int) validate((Number) arg, configuration); + } + + public long validate(long arg, SchemaConfiguration configuration) { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) { + return (double) validate((Number) arg, configuration); } @Override @@ -99,9 +95,31 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -109,7 +127,7 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -118,8 +136,18 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -127,7 +155,7 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -146,12 +174,10 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } From b4fbc30fadb98df0aa38da751be4a94c5afe1904 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 18 Dec 2023 11:55:47 -0800 Subject: [PATCH 12/16] Removes unused variables, fixes variable names --- ...rtiesAllowsASchemaWhichShouldValidate.java | 2 +- ...ditionalpropertiesAreAllowedByDefault.java | 12 ++--- .../AdditionalpropertiesCanExistByItself.java | 2 +- ...lpropertiesShouldNotLookInApplicators.java | 24 +++++----- .../client/components/schemas/Allof.java | 36 +++++++------- .../schemas/AllofCombinedWithAnyofOneof.java | 48 +++++++++---------- .../components/schemas/AllofSimpleTypes.java | 36 +++++++------- .../schemas/AllofWithBaseSchema.java | 36 +++++++------- .../schemas/AllofWithOneEmptySchema.java | 12 ++--- .../schemas/AllofWithTheFirstEmptySchema.java | 12 ++--- .../schemas/AllofWithTheLastEmptySchema.java | 12 ++--- .../schemas/AllofWithTwoEmptySchemas.java | 12 ++--- .../client/components/schemas/Anyof.java | 24 +++++----- .../components/schemas/AnyofComplexTypes.java | 36 +++++++------- .../schemas/AnyofWithBaseSchema.java | 26 +++++----- .../schemas/AnyofWithOneEmptySchema.java | 12 ++--- .../schemas/ArrayTypeMatchesArrays.java | 2 +- .../client/components/schemas/ByInt.java | 12 ++--- .../client/components/schemas/ByNumber.java | 12 ++--- .../components/schemas/BySmallNumber.java | 12 ++--- .../components/schemas/DateTimeFormat.java | 12 ++--- .../components/schemas/EmailFormat.java | 12 ++--- .../schemas/EnumWithEscapedCharacters.java | 2 +- .../schemas/EnumWithFalseDoesNotMatch0.java | 2 +- .../schemas/EnumWithTrueDoesNotMatch1.java | 2 +- .../components/schemas/EnumsInProperties.java | 6 +-- .../components/schemas/ForbiddenProperty.java | 12 ++--- .../components/schemas/HostnameFormat.java | 12 ++--- ...ouldNotRaiseErrorWhenFloatDivisionInf.java | 2 +- .../schemas/InvalidStringValueForDefault.java | 14 +++--- .../client/components/schemas/Ipv4Format.java | 12 ++--- .../client/components/schemas/Ipv6Format.java | 12 ++--- .../components/schemas/JsonPointerFormat.java | 12 ++--- .../components/schemas/MaximumValidation.java | 12 ++--- .../MaximumValidationWithUnsignedInteger.java | 12 ++--- .../schemas/MaxitemsValidation.java | 12 ++--- .../schemas/MaxlengthValidation.java | 12 ++--- .../Maxproperties0MeansTheObjectIsEmpty.java | 12 ++--- .../schemas/MaxpropertiesValidation.java | 12 ++--- .../components/schemas/MinimumValidation.java | 12 ++--- .../MinimumValidationWithSignedInteger.java | 12 ++--- .../schemas/MinitemsValidation.java | 12 ++--- .../schemas/MinlengthValidation.java | 12 ++--- .../schemas/MinpropertiesValidation.java | 12 ++--- ...NestedAllofToCheckValidationSemantics.java | 24 +++++----- ...NestedAnyofToCheckValidationSemantics.java | 24 +++++----- .../components/schemas/NestedItems.java | 8 ++-- ...NestedOneofToCheckValidationSemantics.java | 24 +++++----- .../client/components/schemas/Not.java | 12 ++--- .../schemas/NotMoreComplexSchema.java | 14 +++--- .../schemas/NulCharactersInStrings.java | 2 +- .../schemas/ObjectPropertiesValidation.java | 12 ++--- .../client/components/schemas/Oneof.java | 24 +++++----- .../components/schemas/OneofComplexTypes.java | 36 +++++++------- .../schemas/OneofWithBaseSchema.java | 26 +++++----- .../schemas/OneofWithEmptySchema.java | 12 ++--- .../components/schemas/OneofWithRequired.java | 26 +++++----- .../schemas/PatternIsNotAnchored.java | 12 ++--- .../components/schemas/PatternValidation.java | 12 ++--- .../PropertiesWithEscapedCharacters.java | 12 ++--- .../PropertyNamedRefThatIsNotAReference.java | 12 ++--- .../schemas/RefInAdditionalproperties.java | 2 +- .../client/components/schemas/RefInAllof.java | 12 ++--- .../client/components/schemas/RefInAnyof.java | 12 ++--- .../client/components/schemas/RefInItems.java | 2 +- .../client/components/schemas/RefInNot.java | 12 ++--- .../client/components/schemas/RefInOneof.java | 12 ++--- .../components/schemas/RefInProperty.java | 12 ++--- .../schemas/RequiredDefaultValidation.java | 12 ++--- .../schemas/RequiredValidation.java | 12 ++--- .../schemas/RequiredWithEmptyArray.java | 12 ++--- .../RequiredWithEscapedCharacters.java | 12 ++--- ...esNotDoAnythingIfThePropertyIsMissing.java | 2 +- .../schemas/UniqueitemsFalseValidation.java | 12 ++--- .../schemas/UniqueitemsValidation.java | 12 ++--- .../client/components/schemas/UriFormat.java | 12 ++--- .../schemas/UriReferenceFormat.java | 12 ++--- .../components/schemas/UriTemplateFormat.java | 12 ++--- .../client/schemas/AnyTypeJsonSchema.java | 6 +-- .../client/schemas/ListJsonSchema.java | 32 ++++++++----- .../client/schemas/MapJsonSchema.java | 22 ++++++--- .../client/schemas/NotAnyTypeJsonSchema.java | 4 +- .../validation/UnsetAnyTypeJsonSchema.java | 4 +- .../_Schema_anytypeOrMultitype.hbs | 2 +- .../schemas/SchemaClass/_Schema_boolean.hbs | 2 +- .../schemas/SchemaClass/_Schema_list.hbs | 2 +- .../schemas/SchemaClass/_Schema_map.hbs | 2 +- .../schemas/SchemaClass/_Schema_null.hbs | 2 +- .../schemas/SchemaClass/_Schema_number.hbs | 2 +- .../schemas/SchemaClass/_Schema_string.hbs | 2 +- ... => _getNewInstanceObject_implementor.hbs} | 8 ++-- .../SchemaClass/_validate_implementor.hbs | 16 +++---- .../packagename/schemas/AnyTypeJsonSchema.hbs | 4 +- .../packagename/schemas/ListJsonSchema.hbs | 32 ++++++++----- .../packagename/schemas/MapJsonSchema.hbs | 22 ++++++--- .../schemas/NotAnyTypeJsonSchema.hbs | 4 +- .../validation/UnsetAnyTypeJsonSchema.hbs | 8 +++- 97 files changed, 651 insertions(+), 615 deletions(-) rename src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/{_castToAllowedTypesObject_implementor.hbs => _getNewInstanceObject_implementor.hbs} (87%) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index 1b7d681e111..0a5d58e3873 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -126,7 +126,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index 49cf05b62e5..f7dcbb57b46 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -109,7 +109,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -122,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -135,7 +135,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -164,7 +164,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -248,9 +248,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index a59fa35ba7b..d1f3e45a3f1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -99,7 +99,7 @@ public AdditionalpropertiesCanExistByItselfMap validate(Map arg @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index c4a1aed71c5..8bfc1a229e5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -96,7 +96,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -109,7 +109,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -122,7 +122,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -151,7 +151,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -235,9 +235,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -297,7 +297,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -310,7 +310,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -323,7 +323,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -352,7 +352,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -436,9 +436,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index e244f932d0c..17da069fc6c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -94,7 +94,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -107,7 +107,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -120,7 +120,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -149,7 +149,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -233,9 +233,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -301,7 +301,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -314,7 +314,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -327,7 +327,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -356,7 +356,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -440,9 +440,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -482,7 +482,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -495,7 +495,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -508,7 +508,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -537,7 +537,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -621,9 +621,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index fdbf62e7943..4291a6bfff3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -57,7 +57,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -70,7 +70,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -83,7 +83,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -112,7 +112,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -196,9 +196,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -229,7 +229,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -242,7 +242,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -255,7 +255,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -284,7 +284,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -368,9 +368,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -401,7 +401,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -414,7 +414,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -427,7 +427,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -456,7 +456,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -540,9 +540,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -587,7 +587,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -600,7 +600,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -613,7 +613,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -642,7 +642,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -726,9 +726,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index 214ecc76174..c56c9dbe3eb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -56,7 +56,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -69,7 +69,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -82,7 +82,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -111,7 +111,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -195,9 +195,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -228,7 +228,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -241,7 +241,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -254,7 +254,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -283,7 +283,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -367,9 +367,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -409,7 +409,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -422,7 +422,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -435,7 +435,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -464,7 +464,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -548,9 +548,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index 49f64e655fc..47a01633924 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -95,7 +95,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -108,7 +108,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -121,7 +121,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -150,7 +150,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -234,9 +234,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -302,7 +302,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -315,7 +315,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -328,7 +328,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -357,7 +357,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -441,9 +441,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -519,7 +519,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -532,7 +532,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -545,7 +545,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -574,7 +574,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -658,9 +658,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 9e4f08c72ac..f61a417dbcc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -68,7 +68,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -81,7 +81,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -94,7 +94,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -123,7 +123,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -207,9 +207,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 6faaa6f4304..f24ef12c83e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -73,7 +73,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -86,7 +86,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -99,7 +99,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -128,7 +128,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -212,9 +212,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index ed4b7855131..abd770f8a65 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -73,7 +73,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -86,7 +86,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -99,7 +99,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -128,7 +128,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -212,9 +212,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index 53333e35424..d8cbcbd2dd3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -72,7 +72,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -85,7 +85,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -98,7 +98,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -127,7 +127,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -211,9 +211,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index d1301402d58..3b29887c888 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -60,7 +60,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -73,7 +73,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -86,7 +86,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -115,7 +115,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -199,9 +199,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -241,7 +241,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -254,7 +254,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -267,7 +267,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -296,7 +296,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -380,9 +380,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index cc6878208fa..1aed550d5cd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -94,7 +94,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -107,7 +107,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -120,7 +120,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -149,7 +149,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -233,9 +233,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -301,7 +301,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -314,7 +314,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -327,7 +327,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -356,7 +356,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -440,9 +440,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -482,7 +482,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -495,7 +495,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -508,7 +508,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -537,7 +537,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -621,9 +621,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index 358a9056e8c..e69d8fc5378 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -56,7 +56,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -69,7 +69,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -82,7 +82,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -111,7 +111,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -195,9 +195,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -228,7 +228,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -241,7 +241,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -254,7 +254,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -283,7 +283,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -367,9 +367,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -410,7 +410,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 1a4faa1925b..24805befbaa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -73,7 +73,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -86,7 +86,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -99,7 +99,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -128,7 +128,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -212,9 +212,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 0f4a2671c1b..7f6564f0ea3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -93,7 +93,7 @@ public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index 511daf179f6..1617fa2f4da 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -63,7 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -76,7 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -89,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -118,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -202,9 +202,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index f0a80c4f66f..10511f576ec 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -63,7 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -76,7 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -89,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -118,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -202,9 +202,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index c60b68fc87b..2e4775f02a0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -63,7 +63,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -76,7 +76,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -89,7 +89,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -118,7 +118,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -202,9 +202,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index 35bd312dff9..b4664dd703f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index 3dea7749d3d..499ad160224 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java index 570ac16a86e..aa0789ea6fa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java index 0a5b1aebb85..21f0fadfcaa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java @@ -54,7 +54,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java index eb2aa0da15a..74682194919 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java @@ -54,7 +54,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 44239dc99c2..6bb9fd1c554 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -53,7 +53,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -94,7 +94,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,7 +201,7 @@ public EnumsInPropertiesMap validate(Map arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index bf392f66f1a..3e572c889a2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -100,7 +100,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -113,7 +113,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -126,7 +126,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -155,7 +155,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -239,9 +239,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index 8904eff3aaf..8232003f6cf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java index 0e15a3c46b2..567e856ee3a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java @@ -57,7 +57,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index afefb6f61c4..d97bedd8385 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -58,7 +58,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -133,7 +133,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -146,7 +146,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -159,7 +159,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -188,7 +188,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -272,9 +272,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index f9cd2be3ea8..9b7d1ee5945 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index 6f6208b934c..7f783d25783 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index 4be5571cfb3..01bd1f3866b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index 48f676eae8b..59e9a5da39b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 76a997d840a..3ac95d2fa6d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index fc6ef26854b..4aba4518783 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index fc2031708c6..5661e5e0495 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index c623e6b3eeb..1fa9056537c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 539a61cc42f..add351a25ca 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index c0483afda16..4048ad860b8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 18a57d7c6e9..b9d3966da9d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 89f0441e1fb..9e14a51baf7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index fbc5a50e6cc..1745c290a71 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index cf6adb050b4..d6f2fdd3bd8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index 2d557f62fe1..301858c8372 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -242,7 +242,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -255,7 +255,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -268,7 +268,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -297,7 +297,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -381,9 +381,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index f44bf75f709..f3a891e49e3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -242,7 +242,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -255,7 +255,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -268,7 +268,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -297,7 +297,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -381,9 +381,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index 540f8d5955d..2f88636b24a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -87,7 +87,7 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) t @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -154,7 +154,7 @@ public ItemsList1 validate(List> arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -221,7 +221,7 @@ public ItemsList2 validate(List>> arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -294,7 +294,7 @@ public NestedItemsList validate(List>>> arg, SchemaConfig @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index d0869bd1a86..1ce3354a98f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -242,7 +242,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -255,7 +255,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -268,7 +268,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -297,7 +297,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -381,9 +381,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index dd2794c0ad4..2a441ff1480 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -66,7 +66,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -79,7 +79,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -92,7 +92,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -121,7 +121,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -205,9 +205,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 19ba44beae0..a03d77cd434 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -114,7 +114,7 @@ public NotMap validate(Map arg, SchemaConfiguration configuratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -152,7 +152,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -165,7 +165,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -178,7 +178,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -207,7 +207,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -291,9 +291,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java index 5c795ba1272..1238ba53d50 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java @@ -56,7 +56,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index edf544f68cd..22338c7d4ed 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -110,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -123,7 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -136,7 +136,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -165,7 +165,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -249,9 +249,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index b02b2bae7ce..892c768aef5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -60,7 +60,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -73,7 +73,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -86,7 +86,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -115,7 +115,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -199,9 +199,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -241,7 +241,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -254,7 +254,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -267,7 +267,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -296,7 +296,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -380,9 +380,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 1ca05670b13..8ede2c4c6b7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -94,7 +94,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -107,7 +107,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -120,7 +120,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -149,7 +149,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -233,9 +233,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -301,7 +301,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -314,7 +314,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -327,7 +327,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -356,7 +356,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -440,9 +440,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -482,7 +482,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -495,7 +495,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -508,7 +508,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -537,7 +537,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -621,9 +621,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index e8e2c7a8d29..83fe1b39b69 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -56,7 +56,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -69,7 +69,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -82,7 +82,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -111,7 +111,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -195,9 +195,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -228,7 +228,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -241,7 +241,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -254,7 +254,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -283,7 +283,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -367,9 +367,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -410,7 +410,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index b34c1977634..0defb2ce1fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -73,7 +73,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -86,7 +86,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -99,7 +99,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -128,7 +128,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -212,9 +212,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index 97956fea66c..c1c8b6028b7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -91,7 +91,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -104,7 +104,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -146,7 +146,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -230,9 +230,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -298,7 +298,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -311,7 +311,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -324,7 +324,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -353,7 +353,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -437,9 +437,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -501,7 +501,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 1658b52d7be..26c01a11cd9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -65,7 +65,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -78,7 +78,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -91,7 +91,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -120,7 +120,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -204,9 +204,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 4434bd862c0..ca8e5fbc088 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -65,7 +65,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -78,7 +78,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -91,7 +91,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -120,7 +120,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -204,9 +204,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index 6e1cc12cc52..50c295bed95 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -117,7 +117,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -130,7 +130,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -143,7 +143,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -172,7 +172,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -256,9 +256,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index d6c2b009ea8..02589b02474 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -92,7 +92,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -105,7 +105,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -118,7 +118,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -147,7 +147,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -231,9 +231,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index 6389dc6441c..b8da3d67498 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -95,7 +95,7 @@ public RefInAdditionalpropertiesMap validate(Map arg, SchemaConf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index b2f9c5b8179..9342f3430fa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -64,7 +64,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -77,7 +77,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -90,7 +90,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -119,7 +119,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -203,9 +203,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index c563648799e..7584c5eb76e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -64,7 +64,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -77,7 +77,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -90,7 +90,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -119,7 +119,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -203,9 +203,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index 41d409e2f80..ffdeb9fe08a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -89,7 +89,7 @@ public RefInItemsList validate(List arg, SchemaConfiguration configurati @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index f25a5e39340..d3c85a028a9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index a859bb7fc32..ea2cca6d2a8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -64,7 +64,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -77,7 +77,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -90,7 +90,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -119,7 +119,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -203,9 +203,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index eb810091004..9a32130b10d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -94,7 +94,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -107,7 +107,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -120,7 +120,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -149,7 +149,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -233,9 +233,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 159e42d35fa..8b11ac6b9fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -98,7 +98,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -111,7 +111,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -124,7 +124,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -153,7 +153,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -237,9 +237,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index 74462572f50..3e608194122 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -111,7 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -124,7 +124,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -137,7 +137,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -166,7 +166,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -250,9 +250,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 97d895d9c78..bd67ef0e486 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -98,7 +98,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -111,7 +111,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -124,7 +124,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -153,7 +153,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -237,9 +237,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index fdd7ebe5839..8c833cbd722 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -97,7 +97,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -110,7 +110,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -123,7 +123,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -152,7 +152,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -236,9 +236,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index 0600ee43a2b..8154d298425 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -165,7 +165,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map< @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index 6c79ad91906..569f94d5fd6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index b847057b0a8..317cf9c3651 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index 7b14c215f5c..85c4e34acf7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index 6633fb8d52b..c517ee5d9ea 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 4f844b766b0..dd2ffd0246d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -62,7 +62,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -75,7 +75,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -88,7 +88,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -117,7 +117,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -201,9 +201,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 4b8681051a9..994aa4d4998 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -191,10 +191,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } -} +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index fead19fca16..d89bc4b45ec 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -6,17 +6,14 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.KeywordEntry; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.TypeValidator; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import java.util.ArrayList; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.LinkedHashSet; -import java.util.Map; import java.util.List; import java.util.Objects; import java.util.Set; @@ -38,26 +35,37 @@ public static ListJsonSchema getInstance() { } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = new ArrayList<>(); + pathToItem.add("args[0]"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index cfff6d78b7d..98fb65ee6c3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -6,13 +6,12 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.KeywordEntry; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.TypeValidator; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -38,15 +37,25 @@ public static MapJsonSchema getInstance() { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -56,8 +65,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index 86ff72eb5b9..81217f8c4cb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -193,9 +193,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index ee54fbd1a5c..2622abe53e5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -179,9 +179,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs index 1553efb27c0..d20daedd22d 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs @@ -144,5 +144,5 @@ public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements Nu {{#or mapOutputJsonPathPiece arrayOutputJsonPathPiece}} {{/or}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} - {{> src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor }} + {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs index 070c75108f7..83daa52d9f7 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs @@ -57,5 +57,5 @@ public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements Bo {{!> components/schemas/schema_cls/_else }} {{/if}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} - {{> src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor }} + {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_list.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_list.hbs index 1ce842df3d0..68ecae1d8c7 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_list.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_list.hbs @@ -72,5 +72,5 @@ public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements Li {{!> components/schemas/schema_cls/_unevaluated_items }} {{/if}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} - {{> src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor }} + {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_map.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_map.hbs index b13b8c46382..8f5de98e12e 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_map.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_map.hbs @@ -84,5 +84,5 @@ public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements Ma {{!> components/schemas/schema_cls/_unevaluated_properties }} {{/if}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} - {{> src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor }} + {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_null.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_null.hbs index c495f37a02d..099e5ec4c1d 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_null.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_null.hbs @@ -57,5 +57,5 @@ public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements Nu {{!> components/schemas/schema_cls/_else }} {{/if}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} - {{> src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor }} + {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_number.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_number.hbs index eec8c0f166c..53d54ccac5d 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_number.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_number.hbs @@ -75,5 +75,5 @@ public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements Nu {{!> components/schemas/schema_cls/_else }} {{/if}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} - {{> src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor }} + {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs index 10b706e794c..7997b69df62 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs @@ -72,5 +72,5 @@ public static class {{jsonPathPiece.camelCase}} extends JsonSchema implements St {{!> components/schemas/schema_cls/_else }} {{/if}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} - {{> src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor }} + {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs similarity index 87% rename from src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor.hbs rename to src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs index da5fdf17937..c4a86c51f5c 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_castToAllowedTypesObject_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs @@ -22,10 +22,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((String) arg, pathToItem, pathToSchemas); {{/eq}} {{#eq this "array"}} - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); {{/eq}} {{#eq this "object"}} - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); {{/eq}} {{#if @last}} } @@ -42,9 +42,9 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) castArg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } {{/if}} throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index 9cbfd814bd3..03274cc4492 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -9,7 +9,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } {{/eq}} @@ -92,7 +92,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } {{/eq}} @@ -106,7 +106,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -207,7 +207,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } {{/eq}} @@ -223,7 +223,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -236,7 +236,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -249,7 +249,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } @@ -278,7 +278,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); + getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs index 0f0f10bbdec..4b1006a2d4a 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs @@ -191,9 +191,9 @@ public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs index ae71362e5c8..161a26e3a04 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs @@ -6,17 +6,14 @@ import {{{packageName}}}.schemas.validation.FrozenList; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.KeywordEntry; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.ListSchemaValidator; -import {{{packageName}}}.schemas.validation.TypeValidator; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; +import java.util.ArrayList; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.LinkedHashSet; -import java.util.Map; import java.util.List; import java.util.Objects; import java.util.Set; @@ -38,26 +35,37 @@ public class ListJsonSchema extends JsonSchema implements ListSchemaValidator getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = new ArrayList<>(); + pathToItem.add("args[0]"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs index 338c59575a6..5726a657c28 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs @@ -6,13 +6,12 @@ import {{{packageName}}}.schemas.validation.FrozenMap; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.KeywordEntry; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.MapSchemaValidator; -import {{{packageName}}}.schemas.validation.TypeValidator; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; +import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -38,15 +37,25 @@ public class MapJsonSchema extends JsonSchema implements MapSchemaValidator getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -56,8 +65,7 @@ public class MapJsonSchema extends JsonSchema implements MapSchemaValidator pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs index 7da532b7e86..114b7fbb9bb 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -193,9 +193,9 @@ public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValida } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index b4adbc16075..121cff1d68d 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -5,6 +5,9 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; @@ -12,6 +15,7 @@ import java.util.LinkedHashSet; import java.util.Set; import java.util.Map; import java.util.Objects; +import java.util.UUID; public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static UnsetAnyTypeJsonSchema instance; @@ -175,9 +179,9 @@ public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaVali } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } else if (arg instanceof List) { - return getNewInstance((List) arg, pathToItem, pathToSchemas); + return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { - return getNewInstance((Map) arg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } From 5795de143e4d3ff55b7b5ccb5272a97a978bcd2e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 18 Dec 2023 12:01:01 -0800 Subject: [PATCH 13/16] Updates ArrayTypeSchemaTest --- .../client/schemas/ArrayTypeSchemaTest.java | 30 ++++++++++++------- .../schemas/ArrayTypeSchemaTest.hbs | 30 ++++++++++++------- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 16375e28376..7eb214c07e7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -38,15 +38,25 @@ public ArrayWithItemsSchema() { } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -55,9 +65,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -83,7 +92,7 @@ public ArrayWithOutputClsSchema() { } @Override - public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -102,7 +111,7 @@ public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -111,9 +120,8 @@ public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfigurati @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs index ef5ed276b07..81fe0c968af 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs @@ -38,15 +38,25 @@ public class ArrayTypeSchemaTest { } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenList) arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -55,9 +65,8 @@ public class ArrayTypeSchemaTest { @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -83,7 +92,7 @@ public class ArrayTypeSchemaTest { } @Override - public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -102,7 +111,7 @@ public class ArrayTypeSchemaTest { public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -111,9 +120,8 @@ public class ArrayTypeSchemaTest { @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } From eb22df1acc70463c6a82239d547caf7099fbe28c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 18 Dec 2023 12:07:32 -0800 Subject: [PATCH 14/16] Updates ObjectTypeSchemaTest --- .../client/schemas/ObjectTypeSchemaTest.java | 73 ++++++++++++++----- .../schemas/ObjectTypeSchemaTest.hbs | 72 +++++++++++++----- 2 files changed, 111 insertions(+), 34 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index 11000228fdc..bc13aaf02bf 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -52,15 +53,25 @@ public static ObjectWithPropsSchema getInstance() { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -69,9 +80,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -94,15 +104,25 @@ public static ObjectWithAddpropsSchema getInstance() { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -139,15 +159,25 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -194,15 +224,25 @@ public static ObjectWithOutputTypeSchema getInstance() { } @Override - public ObjectWithOutputTypeSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return new ObjectWithOutputTypeSchemaMap((FrozenMap) arg); + public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } @Override public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -212,8 +252,7 @@ public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaCon @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs index 139c89f74d1..600e0ad8bd2 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs @@ -52,15 +52,25 @@ public class ObjectTypeSchemaTest { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -69,9 +79,8 @@ public class ObjectTypeSchemaTest { @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -94,15 +103,25 @@ public class ObjectTypeSchemaTest { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -139,15 +158,25 @@ public class ObjectTypeSchemaTest { } @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return (FrozenMap) arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -194,15 +223,25 @@ public class ObjectTypeSchemaTest { } @Override - public ObjectWithOutputTypeSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return new ObjectWithOutputTypeSchemaMap((FrozenMap) arg); + public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } @Override public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -212,8 +251,7 @@ public class ObjectTypeSchemaTest { @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } From 291901ea3e06474bc79f7c9f516f4beb34dd9a29 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 18 Dec 2023 12:29:40 -0800 Subject: [PATCH 15/16] Java tests fixed --- ...onalpropertiesAllowsASchemaWhichShouldValidate.md | 2 +- .../schemas/AdditionalpropertiesCanExistByItself.md | 2 +- .../components/schemas/ArrayTypeMatchesArrays.md | 2 +- .../docs/components/schemas/EnumsInProperties.md | 2 +- .../java/docs/components/schemas/NestedItems.md | 8 ++++---- .../docs/components/schemas/NotMoreComplexSchema.md | 2 +- .../docs/components/schemas/OneofWithRequired.md | 2 +- .../components/schemas/RefInAdditionalproperties.md | 2 +- .../java/docs/components/schemas/RefInItems.md | 2 +- ...KeywordDoesNotDoAnythingIfThePropertyIsMissing.md | 2 +- ...alpropertiesAllowsASchemaWhichShouldValidate.java | 2 +- .../AdditionalpropertiesCanExistByItself.java | 2 +- .../components/schemas/ArrayTypeMatchesArrays.java | 2 +- .../client/components/schemas/EnumsInProperties.java | 2 +- .../client/components/schemas/NestedItems.java | 8 ++++---- .../components/schemas/NotMoreComplexSchema.java | 2 +- .../client/components/schemas/OneofWithRequired.java | 2 +- .../schemas/RefInAdditionalproperties.java | 2 +- .../client/components/schemas/RefInItems.java | 2 +- ...ywordDoesNotDoAnythingIfThePropertyIsMissing.java | 2 +- .../client/schemas/ListJsonSchema.java | 2 +- .../client/schemas/MapJsonSchema.java | 2 +- .../client/schemas/validation/TypeValidator.java | 6 ++++++ .../client/schemas/ArrayTypeSchemaTest.java | 4 ++-- .../client/schemas/ObjectTypeSchemaTest.java | 8 ++++---- .../components/schemas/SchemaClass/_types.hbs | 12 ++++++------ .../main/java/packagename/schemas/ListJsonSchema.hbs | 2 +- .../main/java/packagename/schemas/MapJsonSchema.hbs | 2 +- .../packagename/schemas/validation/TypeValidator.hbs | 6 ++++++ .../java/packagename/schemas/ArrayTypeSchemaTest.hbs | 4 ++-- .../packagename/schemas/ObjectTypeSchemaTest.hbs | 9 +++++---- 31 files changed, 61 insertions(+), 48 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md index b1156f7be6a..812f528e5a7 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md @@ -52,7 +52,7 @@ AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsA ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("foo", [Foo.class](#foo))),
        new PropertyEntry("bar", [Bar.class](#bar)))
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesCanExistByItself.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesCanExistByItself.md index cd0dded8e61..9f44bcd9bbd 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesCanExistByItself.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesCanExistByItself.md @@ -50,7 +50,7 @@ AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap val ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/ArrayTypeMatchesArrays.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/ArrayTypeMatchesArrays.md index 0abedb1956b..eadf9051449 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/ArrayTypeMatchesArrays.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/ArrayTypeMatchesArrays.md @@ -50,7 +50,7 @@ ArrayTypeMatchesArrays.ArrayTypeMatchesArraysList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/EnumsInProperties.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/EnumsInProperties.md index 0721b9a4ede..1791e90253b 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/EnumsInProperties.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/EnumsInProperties.md @@ -59,7 +59,7 @@ EnumsInProperties.EnumsInPropertiesMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("foo", [Foo.class](#foo))),
        new PropertyEntry("bar", [Bar.class](#bar)))
    )
| | Set |     required = Set.of(
        "bar"
    )
| diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/NestedItems.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/NestedItems.md index 2e84bf470ce..3b7061133ae 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/NestedItems.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/NestedItems.md @@ -66,7 +66,7 @@ NestedItems.NestedItemsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary @@ -134,7 +134,7 @@ NestedItems.ItemsList2 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items1.class](#items1)
| ### Method Summary @@ -200,7 +200,7 @@ NestedItems.ItemsList1 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items2.class](#items2)
| ### Method Summary @@ -264,7 +264,7 @@ NestedItems.ItemsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items3.class](#items3)
| ### Method Summary diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/NotMoreComplexSchema.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/NotMoreComplexSchema.md index 55af2d0f205..158c174dc5b 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/NotMoreComplexSchema.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/NotMoreComplexSchema.md @@ -79,7 +79,7 @@ NotMoreComplexSchema.NotMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("foo", [Foo.class](#foo)))
    )
| ### Method Summary diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/OneofWithRequired.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/OneofWithRequired.md index 73c4e8af639..392d3468ed4 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/OneofWithRequired.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/OneofWithRequired.md @@ -29,7 +29,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | List> |     oneOf = List.of(
        [Schema0.class](#schema0),
        [Schema1.class](#schema1)
    ))
| ### Method Summary diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/RefInAdditionalproperties.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/RefInAdditionalproperties.md index c5f7b7c05f6..038081b3c0a 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/RefInAdditionalproperties.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/RefInAdditionalproperties.md @@ -49,7 +49,7 @@ RefInAdditionalproperties.RefInAdditionalpropertiesMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.class](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
| ### Method Summary diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/RefInItems.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/RefInItems.md index 700d12b690a..1857920b2d9 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/RefInItems.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/RefInItems.md @@ -49,7 +49,7 @@ RefInItems.RefInItemsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.class](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
| ### Method Summary diff --git a/samples/client/3_0_3_unit_test/java/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md b/samples/client/3_0_3_unit_test/java/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md index 5c439bbc3b3..ad4a9b4e867 100644 --- a/samples/client/3_0_3_unit_test/java/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md +++ b/samples/client/3_0_3_unit_test/java/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md @@ -54,7 +54,7 @@ TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNo ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("alpha", [Alpha.class](#alpha)))
    )
| ### Method Summary diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index 0a5d58e3873..c89522b4543 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -80,7 +80,7 @@ public static class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 extend protected AdditionalpropertiesAllowsASchemaWhichShouldValidate1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("foo", Foo.class), new PropertyEntry("bar", Bar.class) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index d1f3e45a3f1..247722b64a0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -57,7 +57,7 @@ public static class AdditionalpropertiesCanExistByItself1 extends JsonSchema imp protected AdditionalpropertiesCanExistByItself1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties.class) ); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 7f6564f0ea3..1e2019e757c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -51,7 +51,7 @@ public static class ArrayTypeMatchesArrays1 extends JsonSchema implements ListSc protected ArrayTypeMatchesArrays1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 6bb9fd1c554..8674feb5909 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -153,7 +153,7 @@ public static class EnumsInProperties1 extends JsonSchema implements MapSchemaVa protected EnumsInProperties1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("foo", Foo.class), new PropertyEntry("bar", Bar.class) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index 2f88636b24a..4a9146fe209 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -45,7 +45,7 @@ public static class Items2 extends JsonSchema implements ListSchemaValidator argClass; if (arg == null) { argClass = Void.class; + } else if (arg instanceof List) { + argClass = List.class; + } else if (arg instanceof Map) { + argClass = Map.class; } else { argClass = arg.getClass(); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 7eb214c07e7..138ddc6d9fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -32,7 +32,7 @@ public class ArrayTypeSchemaTest { public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator> { public ArrayWithItemsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(StringJsonSchema.class) ); } @@ -85,7 +85,7 @@ public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfigurat public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { public ArrayWithOutputClsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(StringJsonSchema.class) ); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index bc13aaf02bf..ee187d99f40 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -37,7 +37,7 @@ public static class ObjectWithPropsSchema extends JsonSchema implements MapSchem private static ObjectWithPropsSchema instance; private ObjectWithPropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) @@ -91,7 +91,7 @@ public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSc private static ObjectWithAddpropsSchema instance; private ObjectWithAddpropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(StringJsonSchema.class) ); } @@ -143,7 +143,7 @@ public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implemen private static ObjectWithPropsAndAddpropsSchema instance; private ObjectWithPropsAndAddpropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) @@ -209,7 +209,7 @@ public static class ObjectWithOutputTypeSchema extends JsonSchema implements Map private static ObjectWithOutputTypeSchema instance; public ObjectWithOutputTypeSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_types.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_types.hbs index 21908444ef5..90505639abc 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_types.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_types.hbs @@ -1,9 +1,9 @@ {{#if types}} {{#and (eq types.size 1) (or (contains types "null") (contains types "object") (contains types "array") (contains types "boolean"))}} {{#if forDocs}} -    type = Set.of({{#contains types "null"}}Void.class{{/contains}}{{#contains types "object"}}FrozenMap.class{{/contains}}{{#contains types "array"}}FrozenList.class{{/contains}}{{#contains types "boolean"}}Boolean.class{{/contains}})
+    type = Set.of({{#contains types "null"}}Void.class{{/contains}}{{#contains types "object"}}Map.class{{/contains}}{{#contains types "array"}}List.class{{/contains}}{{#contains types "boolean"}}Boolean.class{{/contains}})
{{~else}} -.type(Set.of({{#contains types "null"}}Void.class{{/contains}}{{#contains types "object"}}FrozenMap.class{{/contains}}{{#contains types "array"}}FrozenList.class{{/contains}}{{#contains types "boolean"}}Boolean.class{{/contains}})) +.type(Set.of({{#contains types "null"}}Void.class{{/contains}}{{#contains types "object"}}Map.class{{/contains}}{{#contains types "array"}}List.class{{/contains}}{{#contains types "boolean"}}Boolean.class{{/contains}})) {{/if}} {{else}} {{#if forDocs}} @@ -13,10 +13,10 @@         Void.class{{#unless @last}},{{/unless}}
{{~/eq}} {{#eq this "object"}} -        FrozenMap.class{{#unless @last}},{{/unless}}
+        Map.class{{#unless @last}},{{/unless}}
{{~/eq}} {{#eq this "array"}} -        FrozenList.class{{#unless @last}},{{/unless}}
+        List.class{{#unless @last}},{{/unless}}
{{~/eq}} {{#eq this "string" }} {{#eq ../format "binary"}} @@ -44,10 +44,10 @@ Void.class{{#unless @last}},{{/unless}} {{/eq}} {{#eq this "object"}} - FrozenMap.class{{#unless @last}},{{/unless}} + Map.class{{#unless @last}},{{/unless}} {{/eq}} {{#eq this "array"}} - FrozenList.class{{#unless @last}},{{/unless}} + List.class{{#unless @last}},{{/unless}} {{/eq}} {{#eq this "string" }} {{#eq ../format "binary"}} diff --git a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs index 161a26e3a04..c8d5b45c8a4 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs @@ -23,7 +23,7 @@ public class ListJsonSchema extends JsonSchema implements ListSchemaValidator argClass; if (arg == null) { argClass = Void.class; + } else if (arg instanceof List) { + argClass = List.class; + } else if (arg instanceof Map) { + argClass = Map.class; } else { argClass = arg.getClass(); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs index 81fe0c968af..c91e1386d85 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs @@ -32,7 +32,7 @@ public class ArrayTypeSchemaTest { public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator> { public ArrayWithItemsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(StringJsonSchema.class) ); } @@ -85,7 +85,7 @@ public class ArrayTypeSchemaTest { public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { public ArrayWithOutputClsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(StringJsonSchema.class) ); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs index 600e0ad8bd2..8e4ad93545a 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs @@ -14,6 +14,7 @@ import {{{packageName}}}.schemas.validation.MapSchemaValidator; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; +import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -36,7 +37,7 @@ public class ObjectTypeSchemaTest { private static ObjectWithPropsSchema instance; private ObjectWithPropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) @@ -90,7 +91,7 @@ public class ObjectTypeSchemaTest { private static ObjectWithAddpropsSchema instance; private ObjectWithAddpropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(StringJsonSchema.class) ); } @@ -142,7 +143,7 @@ public class ObjectTypeSchemaTest { private static ObjectWithPropsAndAddpropsSchema instance; private ObjectWithPropsAndAddpropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) @@ -208,7 +209,7 @@ public class ObjectTypeSchemaTest { private static ObjectWithOutputTypeSchema instance; public ObjectWithOutputTypeSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) From 9801055f54adfc25fc7b67696697fb81d7ece5ef Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 18 Dec 2023 12:47:02 -0800 Subject: [PATCH 16/16] Samples regen --- .../content/applicationjson/Schema.md | 2 +- .../content/applicationjson/Schema.md | 2 +- .../content/applicationxml/Schema.md | 2 +- .../content/applicationjson/Schema.md | 2 +- .../components/schemas/AbstractStepMessage.md | 2 +- .../schemas/AdditionalPropertiesClass.md | 14 +- .../schemas/AdditionalPropertiesSchema.md | 8 +- .../AdditionalPropertiesWithArrayOfEnums.md | 4 +- .../java/docs/components/schemas/Address.md | 2 +- .../java/docs/components/schemas/Animal.md | 2 +- .../docs/components/schemas/AnimalFarm.md | 2 +- .../components/schemas/AnyTypeAndFormat.md | 2 +- .../components/schemas/ApiResponseSchema.md | 2 +- .../java/docs/components/schemas/Apple.md | 2 +- .../java/docs/components/schemas/AppleReq.md | 2 +- .../components/schemas/ArrayHoldingAnyType.md | 2 +- .../schemas/ArrayOfArrayOfNumberOnly.md | 6 +- .../docs/components/schemas/ArrayOfEnums.md | 2 +- .../components/schemas/ArrayOfNumberOnly.md | 4 +- .../java/docs/components/schemas/ArrayTest.md | 12 +- .../schemas/ArrayWithValidationsInItems.md | 2 +- .../java/docs/components/schemas/Banana.md | 2 +- .../java/docs/components/schemas/BananaReq.md | 2 +- .../java/docs/components/schemas/BasquePig.md | 2 +- .../docs/components/schemas/Capitalization.md | 2 +- .../java/docs/components/schemas/Cat.md | 2 +- .../java/docs/components/schemas/Category.md | 2 +- .../java/docs/components/schemas/ChildCat.md | 2 +- .../java/docs/components/schemas/Client.md | 2 +- .../schemas/ComplexQuadrilateral.md | 2 +- ...omposedAnyOfDifferentTypesNoValidations.md | 2 +- .../docs/components/schemas/ComposedArray.md | 2 +- .../docs/components/schemas/ComposedObject.md | 2 +- .../schemas/ComposedOneOfDifferentTypes.md | 4 +- .../java/docs/components/schemas/DanishPig.md | 2 +- .../java/docs/components/schemas/Dog.md | 2 +- .../java/docs/components/schemas/Drawing.md | 4 +- .../docs/components/schemas/EnumArrays.md | 4 +- .../java/docs/components/schemas/EnumTest.md | 2 +- .../components/schemas/EquilateralTriangle.md | 2 +- .../java/docs/components/schemas/File.md | 2 +- .../components/schemas/FileSchemaTestClass.md | 4 +- .../java/docs/components/schemas/Foo.md | 2 +- .../docs/components/schemas/FormatTest.md | 4 +- .../docs/components/schemas/FromSchema.md | 2 +- .../components/schemas/GrandparentAnimal.md | 2 +- .../components/schemas/HasOnlyReadOnly.md | 2 +- .../components/schemas/HealthCheckResult.md | 2 +- .../components/schemas/IsoscelesTriangle.md | 2 +- .../java/docs/components/schemas/Items.md | 2 +- .../components/schemas/JSONPatchRequest.md | 2 +- .../schemas/JSONPatchRequestAddReplaceTest.md | 2 +- .../schemas/JSONPatchRequestMoveCopy.md | 2 +- .../schemas/JSONPatchRequestRemove.md | 2 +- .../java/docs/components/schemas/MapTest.md | 10 +- ...dPropertiesAndAdditionalPropertiesClass.md | 4 +- .../java/docs/components/schemas/Money.md | 2 +- .../docs/components/schemas/MyObjectDto.md | 2 +- .../schemas/NoAdditionalProperties.md | 2 +- .../docs/components/schemas/NullableClass.md | 24 +- .../docs/components/schemas/NumberOnly.md | 2 +- .../schemas/ObjWithRequiredProps.md | 2 +- .../schemas/ObjWithRequiredPropsBase.md | 2 +- .../ObjectModelWithArgAndArgsProperties.md | 2 +- .../schemas/ObjectModelWithRefProps.md | 2 +- ...ithAllOfWithReqTestPropFromUnsetAddProp.md | 2 +- .../schemas/ObjectWithCollidingProperties.md | 2 +- .../schemas/ObjectWithDecimalProperties.md | 2 +- .../ObjectWithDifficultlyNamedProps.md | 2 +- .../ObjectWithInlineCompositionProperty.md | 2 +- .../ObjectWithInvalidNamedRefedProperties.md | 2 +- .../ObjectWithNonIntersectingValues.md | 2 +- .../schemas/ObjectWithOnlyOptionalProps.md | 2 +- .../schemas/ObjectWithOptionalTestProp.md | 2 +- .../schemas/ObjectWithValidations.md | 2 +- .../java/docs/components/schemas/Order.md | 2 +- .../schemas/PaginatedResultMyObjectDto.md | 4 +- .../java/docs/components/schemas/ParentPet.md | 2 +- .../java/docs/components/schemas/Pet.md | 6 +- .../java/docs/components/schemas/Player.md | 2 +- .../java/docs/components/schemas/PublicKey.md | 2 +- .../docs/components/schemas/ReadOnlyFirst.md | 2 +- .../schemas/ReqPropsFromExplicitAddProps.md | 2 +- .../schemas/ReqPropsFromTrueAddProps.md | 2 +- .../schemas/ReqPropsFromUnsetAddProps.md | 2 +- .../components/schemas/ScaleneTriangle.md | 2 +- .../schemas/SelfReferencingArrayModel.md | 2 +- .../schemas/SelfReferencingObjectModel.md | 2 +- .../components/schemas/SimpleQuadrilateral.md | 2 +- .../components/schemas/SpecialModelname.md | 2 +- .../components/schemas/StringBooleanMap.md | 2 +- .../java/docs/components/schemas/Tag.md | 2 +- .../java/docs/components/schemas/User.md | 4 +- .../java/docs/components/schemas/Whale.md | 2 +- .../java/docs/components/schemas/Zebra.md | 2 +- .../fake/get/parameters/parameter0/Schema0.md | 2 +- .../fake/get/parameters/parameter2/Schema2.md | 2 +- .../applicationxwwwformurlencoded/Schema.md | 4 +- .../applicationxwwwformurlencoded/Schema.md | 2 +- .../content/applicationjson/Schema.md | 2 +- .../post/parameters/parameter1/Schema1.md | 2 +- .../content/multipartformdata/Schema.md | 2 +- .../content/multipartformdata/Schema.md | 2 +- .../applicationxwwwformurlencoded/Schema.md | 2 +- .../content/applicationjson/Schema.md | 2 +- .../content/multipartformdata/Schema.md | 2 +- .../get/parameters/parameter0/Schema0.md | 2 +- .../content/multipartformdata/Schema.md | 2 +- .../put/parameters/parameter0/Schema0.md | 2 +- .../put/parameters/parameter1/Schema1.md | 2 +- .../put/parameters/parameter2/Schema2.md | 2 +- .../put/parameters/parameter3/Schema3.md | 2 +- .../put/parameters/parameter4/Schema4.md | 2 +- .../content/multipartformdata/Schema.md | 2 +- .../content/multipartformdata/Schema.md | 4 +- .../content/applicationjson/Schema.md | 2 +- .../get/parameters/parameter0/Schema0.md | 2 +- .../get/parameters/parameter0/Schema0.md | 2 +- .../applicationxwwwformurlencoded/Schema.md | 2 +- .../content/multipartformdata/Schema.md | 2 +- .../content/applicationjson/Schema.java | 34 +- .../responses/headerswithnobody/Headers.java | 35 +- .../content/applicationjson/Schema.java | 34 +- .../content/applicationxml/Schema.java | 34 +- .../Headers.java | 35 +- .../content/applicationjson/Schema.java | 35 +- .../successwithjsonapiresponse/Headers.java | 33 +- .../schemas/AbstractStepMessage.java | 32 +- .../schemas/AdditionalPropertiesClass.java | 233 +--- .../schemas/AdditionalPropertiesSchema.java | 391 ++---- .../AdditionalPropertiesWithArrayOfEnums.java | 69 +- .../client/components/schemas/Address.java | 35 +- .../client/components/schemas/Animal.java | 46 +- .../client/components/schemas/AnimalFarm.java | 34 +- .../components/schemas/AnyTypeAndFormat.java | 1175 ++++++----------- .../components/schemas/AnyTypeNotString.java | 127 +- .../components/schemas/ApiResponseSchema.java | 32 +- .../client/components/schemas/Apple.java | 74 +- .../client/components/schemas/AppleReq.java | 33 +- .../schemas/ArrayHoldingAnyType.java | 32 +- .../schemas/ArrayOfArrayOfNumberOnly.java | 100 +- .../components/schemas/ArrayOfEnums.java | 34 +- .../components/schemas/ArrayOfNumberOnly.java | 66 +- .../client/components/schemas/ArrayTest.java | 202 +-- .../schemas/ArrayWithValidationsInItems.java | 48 +- .../client/components/schemas/Banana.java | 32 +- .../client/components/schemas/BananaReq.java | 33 +- .../client/components/schemas/Bar.java | 14 +- .../client/components/schemas/BasquePig.java | 46 +- .../components/schemas/BooleanEnum.java | 14 +- .../components/schemas/Capitalization.java | 32 +- .../client/components/schemas/Cat.java | 159 +-- .../client/components/schemas/Category.java | 46 +- .../client/components/schemas/ChildCat.java | 159 +-- .../client/components/schemas/ClassModel.java | 124 +- .../client/components/schemas/Client.java | 32 +- .../schemas/ComplexQuadrilateral.java | 173 +-- ...posedAnyOfDifferentTypesNoValidations.java | 159 +-- .../components/schemas/ComposedArray.java | 32 +- .../components/schemas/ComposedBool.java | 14 +- .../components/schemas/ComposedNone.java | 14 +- .../components/schemas/ComposedNumber.java | 12 +- .../components/schemas/ComposedObject.java | 40 +- .../schemas/ComposedOneOfDifferentTypes.java | 213 +-- .../components/schemas/ComposedString.java | 14 +- .../client/components/schemas/Currency.java | 14 +- .../client/components/schemas/DanishPig.java | 46 +- .../components/schemas/DateTimeTest.java | 14 +- .../schemas/DateTimeWithValidations.java | 14 +- .../schemas/DateWithValidations.java | 14 +- .../client/components/schemas/Dog.java | 159 +-- .../client/components/schemas/Drawing.java | 65 +- .../client/components/schemas/EnumArrays.java | 94 +- .../client/components/schemas/EnumClass.java | 14 +- .../client/components/schemas/EnumTest.java | 86 +- .../schemas/EquilateralTriangle.java | 173 +-- .../client/components/schemas/File.java | 32 +- .../schemas/FileSchemaTestClass.java | 66 +- .../client/components/schemas/Foo.java | 32 +- .../client/components/schemas/FormatTest.java | 186 +-- .../client/components/schemas/FromSchema.java | 32 +- .../client/components/schemas/Fruit.java | 124 +- .../client/components/schemas/FruitReq.java | 127 +- .../client/components/schemas/GmFruit.java | 124 +- .../components/schemas/GrandparentAnimal.java | 32 +- .../components/schemas/HasOnlyReadOnly.java | 32 +- .../components/schemas/HealthCheckResult.java | 60 +- .../components/schemas/IntegerEnum.java | 14 +- .../components/schemas/IntegerEnumBig.java | 14 +- .../schemas/IntegerEnumOneValue.java | 14 +- .../schemas/IntegerEnumWithDefaultValue.java | 14 +- .../components/schemas/IntegerMax10.java | 14 +- .../components/schemas/IntegerMin15.java | 14 +- .../components/schemas/IsoscelesTriangle.java | 173 +-- .../client/components/schemas/Items.java | 34 +- .../components/schemas/JSONPatchRequest.java | 159 +-- .../JSONPatchRequestAddReplaceTest.java | 47 +- .../schemas/JSONPatchRequestMoveCopy.java | 49 +- .../schemas/JSONPatchRequestRemove.java | 49 +- .../client/components/schemas/Mammal.java | 127 +- .../client/components/schemas/MapTest.java | 183 +-- ...ropertiesAndAdditionalPropertiesClass.java | 67 +- .../client/components/schemas/Money.java | 33 +- .../components/schemas/MyObjectDto.java | 35 +- .../client/components/schemas/Name.java | 124 +- .../schemas/NoAdditionalProperties.java | 35 +- .../components/schemas/NullableClass.java | 729 +++------- .../components/schemas/NullableShape.java | 127 +- .../components/schemas/NullableString.java | 28 +- .../client/components/schemas/NumberOnly.java | 32 +- .../schemas/NumberWithExclusiveMinMax.java | 12 +- .../schemas/NumberWithValidations.java | 12 +- .../schemas/ObjWithRequiredProps.java | 32 +- .../schemas/ObjWithRequiredPropsBase.java | 32 +- .../ObjectModelWithArgAndArgsProperties.java | 32 +- .../schemas/ObjectModelWithRefProps.java | 32 +- ...hAllOfWithReqTestPropFromUnsetAddProp.java | 159 +-- .../ObjectWithCollidingProperties.java | 32 +- .../schemas/ObjectWithDecimalProperties.java | 32 +- .../ObjectWithDifficultlyNamedProps.java | 32 +- .../ObjectWithInlineCompositionProperty.java | 173 +-- ...ObjectWithInvalidNamedRefedProperties.java | 32 +- .../ObjectWithNonIntersectingValues.java | 33 +- .../schemas/ObjectWithOnlyOptionalProps.java | 33 +- .../schemas/ObjectWithOptionalTestProp.java | 32 +- .../schemas/ObjectWithValidations.java | 40 +- .../client/components/schemas/Order.java | 46 +- .../schemas/PaginatedResultMyObjectDto.java | 67 +- .../client/components/schemas/ParentPet.java | 40 +- .../client/components/schemas/Pet.java | 114 +- .../client/components/schemas/Pig.java | 127 +- .../client/components/schemas/Player.java | 32 +- .../client/components/schemas/PublicKey.java | 32 +- .../components/schemas/Quadrilateral.java | 127 +- .../schemas/QuadrilateralInterface.java | 138 +- .../components/schemas/ReadOnlyFirst.java | 32 +- .../schemas/ReqPropsFromExplicitAddProps.java | 35 +- .../schemas/ReqPropsFromTrueAddProps.java | 33 +- .../schemas/ReqPropsFromUnsetAddProps.java | 32 +- .../components/schemas/ReturnSchema.java | 124 +- .../components/schemas/ScaleneTriangle.java | 173 +-- .../components/schemas/Schema200Response.java | 124 +- .../schemas/SelfReferencingArrayModel.java | 34 +- .../schemas/SelfReferencingObjectModel.java | 33 +- .../client/components/schemas/Shape.java | 127 +- .../components/schemas/ShapeOrNull.java | 127 +- .../schemas/SimpleQuadrilateral.java | 173 +-- .../client/components/schemas/SomeObject.java | 127 +- .../components/schemas/SpecialModelname.java | 32 +- .../components/schemas/StringBooleanMap.java | 35 +- .../client/components/schemas/StringEnum.java | 28 +- .../schemas/StringEnumWithDefaultValue.java | 14 +- .../schemas/StringWithValidation.java | 14 +- .../client/components/schemas/Tag.java | 32 +- .../client/components/schemas/Triangle.java | 127 +- .../components/schemas/TriangleInterface.java | 138 +- .../client/components/schemas/UUIDString.java | 14 +- .../client/components/schemas/User.java | 213 +-- .../client/components/schemas/Whale.java | 46 +- .../client/components/schemas/Zebra.java | 61 +- .../delete/HeaderParameters.java | 35 +- .../delete/PathParameters.java | 35 +- .../delete/parameters/parameter1/Schema1.java | 14 +- .../commonparamsubdir/get/PathParameters.java | 35 +- .../get/QueryParameters.java | 35 +- .../parameter0/PathParamSchema0.java | 14 +- .../post/HeaderParameters.java | 35 +- .../post/PathParameters.java | 35 +- .../paths/fake/delete/HeaderParameters.java | 33 +- .../paths/fake/delete/QueryParameters.java | 33 +- .../delete/parameters/parameter1/Schema1.java | 14 +- .../delete/parameters/parameter4/Schema4.java | 14 +- .../paths/fake/get/HeaderParameters.java | 33 +- .../paths/fake/get/QueryParameters.java | 33 +- .../get/parameters/parameter0/Schema0.java | 48 +- .../get/parameters/parameter1/Schema1.java | 14 +- .../get/parameters/parameter2/Schema2.java | 48 +- .../get/parameters/parameter3/Schema3.java | 14 +- .../get/parameters/parameter4/Schema4.java | 14 +- .../get/parameters/parameter5/Schema5.java | 12 +- .../applicationxwwwformurlencoded/Schema.java | 94 +- .../applicationxwwwformurlencoded/Schema.java | 152 +-- .../put/QueryParameters.java | 35 +- .../put/QueryParameters.java | 33 +- .../delete/PathParameters.java | 35 +- .../content/applicationjson/Schema.java | 35 +- .../post/QueryParameters.java | 33 +- .../post/parameters/parameter0/Schema0.java | 141 +- .../post/parameters/parameter1/Schema1.java | 173 +-- .../content/applicationjson/Schema.java | 141 +- .../content/multipartformdata/Schema.java | 173 +-- .../content/applicationjson/Schema.java | 141 +- .../content/multipartformdata/Schema.java | 173 +-- .../applicationxwwwformurlencoded/Schema.java | 32 +- .../content/applicationjson/Schema.java | 32 +- .../content/multipartformdata/Schema.java | 32 +- .../fakeobjinquery/get/QueryParameters.java | 35 +- .../get/parameters/parameter0/Schema0.java | 32 +- .../post/CookieParameters.java | 33 +- .../post/HeaderParameters.java | 33 +- .../post/PathParameters.java | 33 +- .../post/QueryParameters.java | 33 +- .../post/PathParameters.java | 35 +- .../content/multipartformdata/Schema.java | 32 +- .../get/QueryParameters.java | 33 +- .../get/QueryParameters.java | 35 +- .../put/QueryParameters.java | 33 +- .../put/parameters/parameter0/Schema0.java | 34 +- .../put/parameters/parameter1/Schema1.java | 34 +- .../put/parameters/parameter2/Schema2.java | 34 +- .../put/parameters/parameter3/Schema3.java | 34 +- .../put/parameters/parameter4/Schema4.java | 34 +- .../content/multipartformdata/Schema.java | 32 +- .../content/multipartformdata/Schema.java | 66 +- .../content/applicationjson/Schema.java | 32 +- .../petfindbystatus/get/QueryParameters.java | 35 +- .../get/parameters/parameter0/Schema0.java | 48 +- .../petfindbytags/get/QueryParameters.java | 35 +- .../get/parameters/parameter0/Schema0.java | 34 +- .../petpetid/delete/HeaderParameters.java | 35 +- .../paths/petpetid/delete/PathParameters.java | 35 +- .../paths/petpetid/get/PathParameters.java | 35 +- .../paths/petpetid/post/PathParameters.java | 35 +- .../applicationxwwwformurlencoded/Schema.java | 32 +- .../post/PathParameters.java | 35 +- .../content/multipartformdata/Schema.java | 32 +- .../delete/PathParameters.java | 35 +- .../storeorderorderid/get/PathParameters.java | 35 +- .../get/parameters/parameter0/Schema0.java | 14 +- .../paths/userlogin/get/QueryParameters.java | 33 +- .../get/responses/response200/Headers.java | 33 +- .../userusername/delete/PathParameters.java | 35 +- .../userusername/get/PathParameters.java | 35 +- .../userusername/put/PathParameters.java | 35 +- .../client/schemas/AnyTypeJsonSchema.java | 97 +- .../client/schemas/BooleanJsonSchema.java | 5 - .../client/schemas/DateJsonSchema.java | 5 - .../client/schemas/DateTimeJsonSchema.java | 5 - .../client/schemas/DecimalJsonSchema.java | 5 - .../client/schemas/DoubleJsonSchema.java | 5 - .../client/schemas/FloatJsonSchema.java | 5 - .../client/schemas/Int32JsonSchema.java | 5 - .../client/schemas/Int64JsonSchema.java | 5 - .../client/schemas/IntJsonSchema.java | 5 - .../client/schemas/ListJsonSchema.java | 41 +- .../client/schemas/MapJsonSchema.java | 31 +- .../client/schemas/NotAnyTypeJsonSchema.java | 116 +- .../client/schemas/NullJsonSchema.java | 5 - .../client/schemas/NumberJsonSchema.java | 5 - .../client/schemas/StringJsonSchema.java | 5 - .../client/schemas/UuidJsonSchema.java | 5 - .../validation/BooleanSchemaValidator.java | 2 - .../client/schemas/validation/FrozenList.java | 47 +- .../client/schemas/validation/FrozenMap.java | 73 +- .../client/schemas/validation/JsonSchema.java | 82 +- .../validation/ListSchemaValidator.java | 5 +- .../validation/MapSchemaValidator.java | 5 +- .../validation/NullSchemaValidator.java | 2 - .../validation/NumberSchemaValidator.java | 2 - .../validation/StringSchemaValidator.java | 2 - .../schemas/validation/TypeValidator.java | 6 + .../validation/UnsetAnyTypeJsonSchema.java | 114 +- .../client/schemas/ArrayTypeSchemaTest.java | 66 +- .../client/schemas/ObjectTypeSchemaTest.java | 116 +- .../schemas/validation/JsonSchemaTest.java | 1 - 365 files changed, 4610 insertions(+), 11330 deletions(-) diff --git a/samples/client/petstore/java/docs/components/requestbodies/userarray/content/applicationjson/Schema.md b/samples/client/petstore/java/docs/components/requestbodies/userarray/content/applicationjson/Schema.md index 70acf4e93f4..75cc90d170e 100644 --- a/samples/client/petstore/java/docs/components/requestbodies/userarray/content/applicationjson/Schema.md +++ b/samples/client/petstore/java/docs/components/requestbodies/userarray/content/applicationjson/Schema.md @@ -87,7 +87,7 @@ Schema.SchemaList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [User.User1.class](../../../../components/schemas/User.md#user1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/Schema.md b/samples/client/petstore/java/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/Schema.md index 307f9ba454b..f2427996425 100644 --- a/samples/client/petstore/java/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/Schema.md +++ b/samples/client/petstore/java/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/Schema.md @@ -93,7 +93,7 @@ Schema.SchemaList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [RefPet.RefPet1.class](../../../../../components/schemas/RefPet.md#refpet1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/Schema.md b/samples/client/petstore/java/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/Schema.md index 168dcdd21e1..b2d84193db9 100644 --- a/samples/client/petstore/java/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/Schema.md +++ b/samples/client/petstore/java/docs/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/Schema.md @@ -93,7 +93,7 @@ Schema.SchemaList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Pet.Pet1.class](../../../../../components/schemas/Pet.md#pet1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/responses/successinlinecontentandheader/content/applicationjson/Schema.md b/samples/client/petstore/java/docs/components/responses/successinlinecontentandheader/content/applicationjson/Schema.md index da4ab7f926b..e444b244691 100644 --- a/samples/client/petstore/java/docs/components/responses/successinlinecontentandheader/content/applicationjson/Schema.md +++ b/samples/client/petstore/java/docs/components/responses/successinlinecontentandheader/content/applicationjson/Schema.md @@ -50,7 +50,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/AbstractStepMessage.md b/samples/client/petstore/java/docs/components/schemas/AbstractStepMessage.md index d75173611d4..bf695002026 100644 --- a/samples/client/petstore/java/docs/components/schemas/AbstractStepMessage.md +++ b/samples/client/petstore/java/docs/components/schemas/AbstractStepMessage.md @@ -57,7 +57,7 @@ AbstractStepMessage.AbstractStepMessageMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("discriminator", [Discriminator.class](#discriminator)))
    )
| | Set |     required = Set.of(
        "description",
        "discriminator",
        "sequenceNumber"
    )
| | List> |     anyOf = List.of(
        [AbstractStepMessage1.class](#abstractstepmessage1)
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesClass.md b/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesClass.md index a18a5efec6a..66004aec1c0 100644 --- a/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesClass.md +++ b/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesClass.md @@ -100,7 +100,7 @@ AdditionalPropertiesClass.AdditionalPropertiesClassMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("map_property", [MapProperty.class](#mapproperty))),
        new PropertyEntry("map_of_map_property", [MapOfMapProperty.class](#mapofmapproperty))),
        new PropertyEntry("anytype_1", [Anytype1.class](#anytype1))),
        new PropertyEntry("map_with_undeclared_properties_anytype_1", [MapWithUndeclaredPropertiesAnytype1.class](#mapwithundeclaredpropertiesanytype1))),
        new PropertyEntry("map_with_undeclared_properties_anytype_2", [MapWithUndeclaredPropertiesAnytype2.class](#mapwithundeclaredpropertiesanytype2))),
        new PropertyEntry("map_with_undeclared_properties_anytype_3", [MapWithUndeclaredPropertiesAnytype3.class](#mapwithundeclaredpropertiesanytype3))),
        new PropertyEntry("empty_map", [EmptyMap.class](#emptymap))),
        new PropertyEntry("map_with_undeclared_properties_string", [MapWithUndeclaredPropertiesString.class](#mapwithundeclaredpropertiesstring)))
    )
| ### Method Summary @@ -180,7 +180,7 @@ AdditionalPropertiesClass.MapWithUndeclaredPropertiesStringMap validatedPayload ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties5.class](#additionalproperties5)
| ### Method Summary @@ -257,7 +257,7 @@ AdditionalPropertiesClass.EmptyMapMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties4.class](#additionalproperties4)
| ### Method Summary @@ -329,7 +329,7 @@ AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Map validatedPayloa ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties3.class](#additionalproperties3)
| ### Method Summary @@ -433,7 +433,7 @@ AdditionalPropertiesClass.MapOfMapPropertyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties1.class](#additionalproperties1)
| ### Method Summary @@ -497,7 +497,7 @@ AdditionalPropertiesClass.AdditionalPropertiesMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties2.class](#additionalproperties2)
| ### Method Summary @@ -571,7 +571,7 @@ AdditionalPropertiesClass.MapPropertyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesSchema.md b/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesSchema.md index 4b2f5957fcc..5bdfdf11750 100644 --- a/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesSchema.md +++ b/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesSchema.md @@ -35,7 +35,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | List> |     allOf = List.of(
        [Schema0.class](#schema0),
        [Schema1.class](#schema1),
        [Schema2.class](#schema2)
    )
| ### Method Summary @@ -76,7 +76,7 @@ AdditionalPropertiesSchema.Schema2Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties2.class](#additionalproperties2)
| ### Method Summary @@ -164,7 +164,7 @@ AdditionalPropertiesSchema.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties1.class](#additionalproperties1)
| ### Method Summary @@ -252,7 +252,7 @@ AdditionalPropertiesSchema.Schema0Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md b/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md index fec7382cc99..1f29b6e09e5 100644 --- a/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md +++ b/samples/client/petstore/java/docs/components/schemas/AdditionalPropertiesWithArrayOfEnums.md @@ -52,7 +52,7 @@ AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMap val ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary @@ -117,7 +117,7 @@ AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [EnumClass.EnumClass1.class](../../components/schemas/EnumClass.md#enumclass1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Address.md b/samples/client/petstore/java/docs/components/schemas/Address.md index 2eaeccd3132..b4a95404724 100644 --- a/samples/client/petstore/java/docs/components/schemas/Address.md +++ b/samples/client/petstore/java/docs/components/schemas/Address.md @@ -50,7 +50,7 @@ Address.AddressMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Animal.md b/samples/client/petstore/java/docs/components/schemas/Animal.md index 014afd8f46a..b1723bb44e0 100644 --- a/samples/client/petstore/java/docs/components/schemas/Animal.md +++ b/samples/client/petstore/java/docs/components/schemas/Animal.md @@ -59,7 +59,7 @@ Animal.AnimalMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("className", [ClassName.class](#classname))),
        new PropertyEntry("color", [Color.class](#color)))
    )
| | Set |     required = Set.of(
        "className"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/AnimalFarm.md b/samples/client/petstore/java/docs/components/schemas/AnimalFarm.md index 1640f50ad7b..b9c374d2e19 100644 --- a/samples/client/petstore/java/docs/components/schemas/AnimalFarm.md +++ b/samples/client/petstore/java/docs/components/schemas/AnimalFarm.md @@ -59,7 +59,7 @@ AnimalFarm.AnimalFarmList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Animal.Animal1.class](../../components/schemas/Animal.md#animal1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/AnyTypeAndFormat.md b/samples/client/petstore/java/docs/components/schemas/AnyTypeAndFormat.md index b0997c171e8..456af1b4489 100644 --- a/samples/client/petstore/java/docs/components/schemas/AnyTypeAndFormat.md +++ b/samples/client/petstore/java/docs/components/schemas/AnyTypeAndFormat.md @@ -58,7 +58,7 @@ AnyTypeAndFormat.AnyTypeAndFormatMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
        new PropertyEntry("date", [Date.class](#date))),
        new PropertyEntry("date-time", [Datetime.class](#datetime))),
        new PropertyEntry("number", [NumberSchema.class](#numberschema))),
        new PropertyEntry("binary", [Binary.class](#binary))),
        new PropertyEntry("int32", [Int32.class](#int32))),
        new PropertyEntry("int64", [Int64.class](#int64))),
        new PropertyEntry("double", [DoubleSchema.class](#doubleschema))),
        new PropertyEntry("float", [FloatSchema.class](#floatschema)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ApiResponseSchema.md b/samples/client/petstore/java/docs/components/schemas/ApiResponseSchema.md index 46931cc0fd0..4e97e177ee8 100644 --- a/samples/client/petstore/java/docs/components/schemas/ApiResponseSchema.md +++ b/samples/client/petstore/java/docs/components/schemas/ApiResponseSchema.md @@ -64,7 +64,7 @@ ApiResponseSchema.ApiResponseMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("code", [Code.class](#code))),
        new PropertyEntry("type", [Type.class](#type))),
        new PropertyEntry("message", [Message.class](#message)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Apple.md b/samples/client/petstore/java/docs/components/schemas/Apple.md index c71127b0c94..d3a60eec2c3 100644 --- a/samples/client/petstore/java/docs/components/schemas/Apple.md +++ b/samples/client/petstore/java/docs/components/schemas/Apple.md @@ -65,7 +65,7 @@ Apple.AppleMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("cultivar", [Cultivar.class](#cultivar))),
        new PropertyEntry("origin", [Origin.class](#origin)))
    )
| | Set |     required = Set.of(
        "cultivar"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/AppleReq.md b/samples/client/petstore/java/docs/components/schemas/AppleReq.md index 2d393732d61..8f95664835b 100644 --- a/samples/client/petstore/java/docs/components/schemas/AppleReq.md +++ b/samples/client/petstore/java/docs/components/schemas/AppleReq.md @@ -60,7 +60,7 @@ AppleReq.AppleReqMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("cultivar", [Cultivar.class](#cultivar))),
        new PropertyEntry("mealy", [Mealy.class](#mealy)))
    )
| | Set |     required = Set.of(
        "cultivar"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/ArrayHoldingAnyType.md b/samples/client/petstore/java/docs/components/schemas/ArrayHoldingAnyType.md index e0d38ed11ed..c7d1d6ef3ca 100644 --- a/samples/client/petstore/java/docs/components/schemas/ArrayHoldingAnyType.md +++ b/samples/client/petstore/java/docs/components/schemas/ArrayHoldingAnyType.md @@ -50,7 +50,7 @@ ArrayHoldingAnyType.ArrayHoldingAnyTypeList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/docs/components/schemas/ArrayOfArrayOfNumberOnly.md index 19f3fcd5da3..6c67dfa2413 100644 --- a/samples/client/petstore/java/docs/components/schemas/ArrayOfArrayOfNumberOnly.md +++ b/samples/client/petstore/java/docs/components/schemas/ArrayOfArrayOfNumberOnly.md @@ -64,7 +64,7 @@ ArrayOfArrayOfNumberOnly.ArrayOfArrayOfNumberOnlyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("ArrayArrayNumber", [ArrayArrayNumber.class](#arrayarraynumber)))
    )
| ### Method Summary @@ -133,7 +133,7 @@ ArrayOfArrayOfNumberOnly.ArrayArrayNumberList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary @@ -197,7 +197,7 @@ ArrayOfArrayOfNumberOnly.ItemsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items1.class](#items1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ArrayOfEnums.md b/samples/client/petstore/java/docs/components/schemas/ArrayOfEnums.md index accf0ed0526..0d4edd7df0b 100644 --- a/samples/client/petstore/java/docs/components/schemas/ArrayOfEnums.md +++ b/samples/client/petstore/java/docs/components/schemas/ArrayOfEnums.md @@ -50,7 +50,7 @@ ArrayOfEnums.ArrayOfEnumsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [StringEnum.StringEnum1.class](../../components/schemas/StringEnum.md#stringenum1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ArrayOfNumberOnly.md b/samples/client/petstore/java/docs/components/schemas/ArrayOfNumberOnly.md index ae5fa454157..090240b83a4 100644 --- a/samples/client/petstore/java/docs/components/schemas/ArrayOfNumberOnly.md +++ b/samples/client/petstore/java/docs/components/schemas/ArrayOfNumberOnly.md @@ -59,7 +59,7 @@ ArrayOfNumberOnly.ArrayOfNumberOnlyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("ArrayNumber", [ArrayNumber.class](#arraynumber)))
    )
| ### Method Summary @@ -126,7 +126,7 @@ ArrayOfNumberOnly.ArrayNumberList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ArrayTest.md b/samples/client/petstore/java/docs/components/schemas/ArrayTest.md index 5eeff6fae2d..d9171ced086 100644 --- a/samples/client/petstore/java/docs/components/schemas/ArrayTest.md +++ b/samples/client/petstore/java/docs/components/schemas/ArrayTest.md @@ -97,7 +97,7 @@ ArrayTest.ArrayTestMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("array_of_string", [ArrayOfString.class](#arrayofstring))),
        new PropertyEntry("array_array_of_integer", [ArrayArrayOfInteger.class](#arrayarrayofinteger))),
        new PropertyEntry("array_array_of_model", [ArrayArrayOfModel.class](#arrayarrayofmodel)))
    )
| ### Method Summary @@ -179,7 +179,7 @@ ArrayTest.ArrayArrayOfModelList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items3.class](#items3)
| ### Method Summary @@ -252,7 +252,7 @@ ArrayTest.ItemsList1 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [ReadOnlyFirst.ReadOnlyFirst1.class](../../components/schemas/ReadOnlyFirst.md#readonlyfirst1)
| ### Method Summary @@ -318,7 +318,7 @@ ArrayTest.ArrayArrayOfIntegerList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items1.class](#items1)
| ### Method Summary @@ -382,7 +382,7 @@ ArrayTest.ItemsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items2.class](#items2)
| ### Method Summary @@ -456,7 +456,7 @@ ArrayTest.ArrayOfStringList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ArrayWithValidationsInItems.md b/samples/client/petstore/java/docs/components/schemas/ArrayWithValidationsInItems.md index 38cac07602f..31e7b8e40a1 100644 --- a/samples/client/petstore/java/docs/components/schemas/ArrayWithValidationsInItems.md +++ b/samples/client/petstore/java/docs/components/schemas/ArrayWithValidationsInItems.md @@ -51,7 +51,7 @@ ArrayWithValidationsInItems.ArrayWithValidationsInItemsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| | Integer |     maxItems = 2
| diff --git a/samples/client/petstore/java/docs/components/schemas/Banana.md b/samples/client/petstore/java/docs/components/schemas/Banana.md index c1926670f0c..d6facbcfac5 100644 --- a/samples/client/petstore/java/docs/components/schemas/Banana.md +++ b/samples/client/petstore/java/docs/components/schemas/Banana.md @@ -54,7 +54,7 @@ Banana.BananaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("lengthCm", [LengthCm.class](#lengthcm)))
    )
| | Set |     required = Set.of(
        "lengthCm"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/BananaReq.md b/samples/client/petstore/java/docs/components/schemas/BananaReq.md index f779dc0ae58..1706c7caad0 100644 --- a/samples/client/petstore/java/docs/components/schemas/BananaReq.md +++ b/samples/client/petstore/java/docs/components/schemas/BananaReq.md @@ -60,7 +60,7 @@ BananaReq.BananaReqMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("lengthCm", [LengthCm.class](#lengthcm))),
        new PropertyEntry("sweet", [Sweet.class](#sweet)))
    )
| | Set |     required = Set.of(
        "lengthCm"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/BasquePig.md b/samples/client/petstore/java/docs/components/schemas/BasquePig.md index eaee77c87b8..54bd4568ac9 100644 --- a/samples/client/petstore/java/docs/components/schemas/BasquePig.md +++ b/samples/client/petstore/java/docs/components/schemas/BasquePig.md @@ -54,7 +54,7 @@ BasquePig.BasquePigMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("className", [ClassName.class](#classname)))
    )
| | Set |     required = Set.of(
        "className"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/Capitalization.md b/samples/client/petstore/java/docs/components/schemas/Capitalization.md index f10fc2dd2bf..4d306c22b18 100644 --- a/samples/client/petstore/java/docs/components/schemas/Capitalization.md +++ b/samples/client/petstore/java/docs/components/schemas/Capitalization.md @@ -79,7 +79,7 @@ Capitalization.CapitalizationMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("smallCamel", [SmallCamel.class](#smallcamel))),
        new PropertyEntry("CapitalCamel", [CapitalCamel.class](#capitalcamel))),
        new PropertyEntry("small_Snake", [SmallSnake.class](#smallsnake))),
        new PropertyEntry("Capital_Snake", [CapitalSnake.class](#capitalsnake))),
        new PropertyEntry("SCA_ETH_Flow_Points", [SCAETHFlowPoints.class](#scaethflowpoints))),
        new PropertyEntry("ATT_NAME", [ATTNAME.class](#attname)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Cat.md b/samples/client/petstore/java/docs/components/schemas/Cat.md index bb1891a60d7..5f63e1f176e 100644 --- a/samples/client/petstore/java/docs/components/schemas/Cat.md +++ b/samples/client/petstore/java/docs/components/schemas/Cat.md @@ -79,7 +79,7 @@ Cat.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("declawed", [Declawed.class](#declawed)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Category.md b/samples/client/petstore/java/docs/components/schemas/Category.md index 77cbe227575..6b91f871338 100644 --- a/samples/client/petstore/java/docs/components/schemas/Category.md +++ b/samples/client/petstore/java/docs/components/schemas/Category.md @@ -59,7 +59,7 @@ Category.CategoryMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("id", [Id.class](#id))),
        new PropertyEntry("name", [Name.class](#name)))
    )
| | Set |     required = Set.of(
        "name"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/ChildCat.md b/samples/client/petstore/java/docs/components/schemas/ChildCat.md index 6e0fe22d1c6..d7e86624128 100644 --- a/samples/client/petstore/java/docs/components/schemas/ChildCat.md +++ b/samples/client/petstore/java/docs/components/schemas/ChildCat.md @@ -79,7 +79,7 @@ ChildCat.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("name", [Name.class](#name)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Client.md b/samples/client/petstore/java/docs/components/schemas/Client.md index b7a9c12bfca..d495d8b4fcd 100644 --- a/samples/client/petstore/java/docs/components/schemas/Client.md +++ b/samples/client/petstore/java/docs/components/schemas/Client.md @@ -54,7 +54,7 @@ Client.ClientMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("client", [Client2.class](#client2)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ComplexQuadrilateral.md b/samples/client/petstore/java/docs/components/schemas/ComplexQuadrilateral.md index 0c8d29f7c2d..c471df4feeb 100644 --- a/samples/client/petstore/java/docs/components/schemas/ComplexQuadrilateral.md +++ b/samples/client/petstore/java/docs/components/schemas/ComplexQuadrilateral.md @@ -79,7 +79,7 @@ ComplexQuadrilateral.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("quadrilateralType", [QuadrilateralType.class](#quadrilateraltype)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md b/samples/client/petstore/java/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md index d0a25db6942..5cae273e1ed 100644 --- a/samples/client/petstore/java/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md +++ b/samples/client/petstore/java/docs/components/schemas/ComposedAnyOfDifferentTypesNoValidations.md @@ -150,7 +150,7 @@ ComposedAnyOfDifferentTypesNoValidations.Schema9List validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ComposedArray.md b/samples/client/petstore/java/docs/components/schemas/ComposedArray.md index 14b739cf5eb..b9c0b0f7a34 100644 --- a/samples/client/petstore/java/docs/components/schemas/ComposedArray.md +++ b/samples/client/petstore/java/docs/components/schemas/ComposedArray.md @@ -50,7 +50,7 @@ ComposedArray.ComposedArrayList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ComposedObject.md b/samples/client/petstore/java/docs/components/schemas/ComposedObject.md index 83e48916843..475308b0e12 100644 --- a/samples/client/petstore/java/docs/components/schemas/ComposedObject.md +++ b/samples/client/petstore/java/docs/components/schemas/ComposedObject.md @@ -24,7 +24,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | List> |     allOf = List.of(
        [Schema0.class](#schema0)
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ComposedOneOfDifferentTypes.md b/samples/client/petstore/java/docs/components/schemas/ComposedOneOfDifferentTypes.md index be63d4049cc..01faac9c8cb 100644 --- a/samples/client/petstore/java/docs/components/schemas/ComposedOneOfDifferentTypes.md +++ b/samples/client/petstore/java/docs/components/schemas/ComposedOneOfDifferentTypes.md @@ -122,7 +122,7 @@ ComposedOneOfDifferentTypes.Schema5List validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| | Integer |     maxItems = 4
| | Integer |     minItems = 4
| @@ -173,7 +173,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Integer |     maxProperties = 4
| | Integer |     minProperties = 4
| diff --git a/samples/client/petstore/java/docs/components/schemas/DanishPig.md b/samples/client/petstore/java/docs/components/schemas/DanishPig.md index 0942c773e22..64828761a5f 100644 --- a/samples/client/petstore/java/docs/components/schemas/DanishPig.md +++ b/samples/client/petstore/java/docs/components/schemas/DanishPig.md @@ -54,7 +54,7 @@ DanishPig.DanishPigMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("className", [ClassName.class](#classname)))
    )
| | Set |     required = Set.of(
        "className"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/Dog.md b/samples/client/petstore/java/docs/components/schemas/Dog.md index b2cf90801b5..d778e28fd72 100644 --- a/samples/client/petstore/java/docs/components/schemas/Dog.md +++ b/samples/client/petstore/java/docs/components/schemas/Dog.md @@ -79,7 +79,7 @@ Dog.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("breed", [Breed.class](#breed)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Drawing.md b/samples/client/petstore/java/docs/components/schemas/Drawing.md index 9d3f2a1d898..1084429ef31 100644 --- a/samples/client/petstore/java/docs/components/schemas/Drawing.md +++ b/samples/client/petstore/java/docs/components/schemas/Drawing.md @@ -57,7 +57,7 @@ Drawing.DrawingMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("mainShape", [Shape.Shape1.class](../../components/schemas/Shape.md#shape1)),
        new PropertyEntry("shapeOrNull", [ShapeOrNull.ShapeOrNull1.class](../../components/schemas/ShapeOrNull.md#shapeornull1)),
        new PropertyEntry("nullableShape", [NullableShape.NullableShape1.class](../../components/schemas/NullableShape.md#nullableshape1)),
        new PropertyEntry("shapes", [Shapes.class](#shapes)))
    )
| | Class |     additionalProperties = [Fruit.Fruit1.class](../../components/schemas/Fruit.md#fruit1)
| @@ -130,7 +130,7 @@ Drawing.ShapesList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Shape.Shape1.class](../../components/schemas/Shape.md#shape1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/EnumArrays.md b/samples/client/petstore/java/docs/components/schemas/EnumArrays.md index 8e82fdb9284..43a19f0d125 100644 --- a/samples/client/petstore/java/docs/components/schemas/EnumArrays.md +++ b/samples/client/petstore/java/docs/components/schemas/EnumArrays.md @@ -64,7 +64,7 @@ EnumArrays.EnumArraysMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("just_symbol", [JustSymbol.class](#justsymbol))),
        new PropertyEntry("array_enum", [ArrayEnum.class](#arrayenum)))
    )
| ### Method Summary @@ -133,7 +133,7 @@ EnumArrays.ArrayEnumList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/EnumTest.md b/samples/client/petstore/java/docs/components/schemas/EnumTest.md index 994471f11d5..f66fe8b8307 100644 --- a/samples/client/petstore/java/docs/components/schemas/EnumTest.md +++ b/samples/client/petstore/java/docs/components/schemas/EnumTest.md @@ -69,7 +69,7 @@ EnumTest.EnumTestMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("enum_string", [EnumString.class](#enumstring))),
        new PropertyEntry("enum_string_required", [EnumStringRequired.class](#enumstringrequired))),
        new PropertyEntry("enum_integer", [EnumInteger.class](#enuminteger))),
        new PropertyEntry("enum_number", [EnumNumber.class](#enumnumber))),
        new PropertyEntry("stringEnum", [StringEnum.StringEnum1.class](../../components/schemas/StringEnum.md#stringenum1)),
        new PropertyEntry("IntegerEnum", [IntegerEnum.IntegerEnum1.class](../../components/schemas/IntegerEnum.md#integerenum1)),
        new PropertyEntry("StringEnumWithDefaultValue", [StringEnumWithDefaultValue.StringEnumWithDefaultValue1.class](../../components/schemas/StringEnumWithDefaultValue.md#stringenumwithdefaultvalue1)),
        new PropertyEntry("IntegerEnumWithDefaultValue", [IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.class](../../components/schemas/IntegerEnumWithDefaultValue.md#integerenumwithdefaultvalue1)),
        new PropertyEntry("IntegerEnumOneValue", [IntegerEnumOneValue.IntegerEnumOneValue1.class](../../components/schemas/IntegerEnumOneValue.md#integerenumonevalue1))
    )
| | Set |     required = Set.of(
        "enum_string_required"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/EquilateralTriangle.md b/samples/client/petstore/java/docs/components/schemas/EquilateralTriangle.md index 5ce520d975d..731d9b89d7e 100644 --- a/samples/client/petstore/java/docs/components/schemas/EquilateralTriangle.md +++ b/samples/client/petstore/java/docs/components/schemas/EquilateralTriangle.md @@ -79,7 +79,7 @@ EquilateralTriangle.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/File.md b/samples/client/petstore/java/docs/components/schemas/File.md index b3e014b4a6f..82461a7f6ef 100644 --- a/samples/client/petstore/java/docs/components/schemas/File.md +++ b/samples/client/petstore/java/docs/components/schemas/File.md @@ -57,7 +57,7 @@ File.FileMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("sourceURI", [SourceURI.class](#sourceuri)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/FileSchemaTestClass.md b/samples/client/petstore/java/docs/components/schemas/FileSchemaTestClass.md index c8ee0c0b1d0..885b460d434 100644 --- a/samples/client/petstore/java/docs/components/schemas/FileSchemaTestClass.md +++ b/samples/client/petstore/java/docs/components/schemas/FileSchemaTestClass.md @@ -57,7 +57,7 @@ FileSchemaTestClass.FileSchemaTestClassMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("file", [File.File1.class](../../components/schemas/File.md#file1)),
        new PropertyEntry("files", [Files.class](#files)))
    )
| ### Method Summary @@ -125,7 +125,7 @@ FileSchemaTestClass.FilesList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [File.File1.class](../../components/schemas/File.md#file1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Foo.md b/samples/client/petstore/java/docs/components/schemas/Foo.md index 5877ab3a654..e2abbf436d3 100644 --- a/samples/client/petstore/java/docs/components/schemas/Foo.md +++ b/samples/client/petstore/java/docs/components/schemas/Foo.md @@ -49,7 +49,7 @@ Foo.FooMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("bar", [Bar.Bar1.class](../../components/schemas/Bar.md#bar1))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/FormatTest.md b/samples/client/petstore/java/docs/components/schemas/FormatTest.md index d21b201116c..4e7c67891cf 100644 --- a/samples/client/petstore/java/docs/components/schemas/FormatTest.md +++ b/samples/client/petstore/java/docs/components/schemas/FormatTest.md @@ -159,7 +159,7 @@ FormatTest.FormatTestMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("integer", [IntegerSchema.class](#integerschema))),
        new PropertyEntry("int32", [Int32.class](#int32))),
        new PropertyEntry("int32withValidations", [Int32withValidations.class](#int32withvalidations))),
        new PropertyEntry("int64", [Int64.class](#int64))),
        new PropertyEntry("number", [NumberSchema.class](#numberschema))),
        new PropertyEntry("float", [FloatSchema.class](#floatschema))),
        new PropertyEntry("float32", [Float32.class](#float32))),
        new PropertyEntry("double", [DoubleSchema.class](#doubleschema))),
        new PropertyEntry("float64", [Float64.class](#float64))),
        new PropertyEntry("arrayWithUniqueItems", [ArrayWithUniqueItems.class](#arraywithuniqueitems))),
        new PropertyEntry("string", [StringSchema.class](#stringschema))),
        new PropertyEntry("byte", [ByteSchema.class](#byteschema))),
        new PropertyEntry("binary", [Binary.class](#binary))),
        new PropertyEntry("date", [Date.class](#date))),
        new PropertyEntry("dateTime", [DateTime.class](#datetime))),
        new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
        new PropertyEntry("uuidNoExample", [UuidNoExample.class](#uuidnoexample))),
        new PropertyEntry("password", [Password.class](#password))),
        new PropertyEntry("pattern_with_digits", [PatternWithDigits.class](#patternwithdigits))),
        new PropertyEntry("pattern_with_digits_and_delimiter", [PatternWithDigitsAndDelimiter.class](#patternwithdigitsanddelimiter))),
        new PropertyEntry("noneProp", [NoneProp.class](#noneprop)))
    )
| | Set |     required = Set.of(
        "byte",
        "date",
        "number",
        "password"
    )
| @@ -487,7 +487,7 @@ FormatTest.ArrayWithUniqueItemsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| | Boolean |     uniqueItems = true
| diff --git a/samples/client/petstore/java/docs/components/schemas/FromSchema.md b/samples/client/petstore/java/docs/components/schemas/FromSchema.md index 214e6bc57cd..3b6f004cd6a 100644 --- a/samples/client/petstore/java/docs/components/schemas/FromSchema.md +++ b/samples/client/petstore/java/docs/components/schemas/FromSchema.md @@ -59,7 +59,7 @@ FromSchema.FromSchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("data", [Data.class](#data))),
        new PropertyEntry("id", [Id.class](#id)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/GrandparentAnimal.md b/samples/client/petstore/java/docs/components/schemas/GrandparentAnimal.md index 8a8810bad0f..79fd1a36e80 100644 --- a/samples/client/petstore/java/docs/components/schemas/GrandparentAnimal.md +++ b/samples/client/petstore/java/docs/components/schemas/GrandparentAnimal.md @@ -54,7 +54,7 @@ GrandparentAnimal.GrandparentAnimalMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("pet_type", [PetType.class](#pettype)))
    )
| | Set |     required = Set.of(
        "pet_type"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/HasOnlyReadOnly.md b/samples/client/petstore/java/docs/components/schemas/HasOnlyReadOnly.md index 4b40d0d0961..564527e7171 100644 --- a/samples/client/petstore/java/docs/components/schemas/HasOnlyReadOnly.md +++ b/samples/client/petstore/java/docs/components/schemas/HasOnlyReadOnly.md @@ -59,7 +59,7 @@ HasOnlyReadOnly.HasOnlyReadOnlyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("bar", [Bar.class](#bar))),
        new PropertyEntry("foo", [Foo.class](#foo)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/HealthCheckResult.md b/samples/client/petstore/java/docs/components/schemas/HealthCheckResult.md index 1e64bfdfd7c..202ccdef1e7 100644 --- a/samples/client/petstore/java/docs/components/schemas/HealthCheckResult.md +++ b/samples/client/petstore/java/docs/components/schemas/HealthCheckResult.md @@ -57,7 +57,7 @@ HealthCheckResult.HealthCheckResultMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("NullableMessage", [NullableMessage.class](#nullablemessage)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/IsoscelesTriangle.md b/samples/client/petstore/java/docs/components/schemas/IsoscelesTriangle.md index 3a1c5fbc702..b14d0af3a0c 100644 --- a/samples/client/petstore/java/docs/components/schemas/IsoscelesTriangle.md +++ b/samples/client/petstore/java/docs/components/schemas/IsoscelesTriangle.md @@ -79,7 +79,7 @@ IsoscelesTriangle.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Items.md b/samples/client/petstore/java/docs/components/schemas/Items.md index fefa1a15db8..bfe3faabcd9 100644 --- a/samples/client/petstore/java/docs/components/schemas/Items.md +++ b/samples/client/petstore/java/docs/components/schemas/Items.md @@ -53,7 +53,7 @@ Items.ItemsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items2.class](#items2)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/JSONPatchRequest.md b/samples/client/petstore/java/docs/components/schemas/JSONPatchRequest.md index 8a0198be55e..efc08ce033e 100644 --- a/samples/client/petstore/java/docs/components/schemas/JSONPatchRequest.md +++ b/samples/client/petstore/java/docs/components/schemas/JSONPatchRequest.md @@ -50,7 +50,7 @@ JSONPatchRequest.JSONPatchRequestList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestAddReplaceTest.md b/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestAddReplaceTest.md index c2186816132..e1724debc26 100644 --- a/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestAddReplaceTest.md +++ b/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestAddReplaceTest.md @@ -61,7 +61,7 @@ JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMap validatedPayloa ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("path", [Path.class](#path))),
        new PropertyEntry("value", [Value.class](#value))),
        new PropertyEntry("op", [Op.class](#op)))
    )
| | Set |     required = Set.of(
        "op",
        "path",
        "value"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestMoveCopy.md b/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestMoveCopy.md index 6738b4f4a09..0e1a353bfb3 100644 --- a/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestMoveCopy.md +++ b/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestMoveCopy.md @@ -65,7 +65,7 @@ JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("from", [From.class](#from))),
        new PropertyEntry("path", [Path.class](#path))),
        new PropertyEntry("op", [Op.class](#op)))
    )
| | Set |     required = Set.of(
        "from",
        "op",
        "path"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestRemove.md b/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestRemove.md index f1ae621c925..89e1a4610c8 100644 --- a/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestRemove.md +++ b/samples/client/petstore/java/docs/components/schemas/JSONPatchRequestRemove.md @@ -60,7 +60,7 @@ JSONPatchRequestRemove.JSONPatchRequestRemoveMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("path", [Path.class](#path))),
        new PropertyEntry("op", [Op.class](#op)))
    )
| | Set |     required = Set.of(
        "op",
        "path"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/MapTest.md b/samples/client/petstore/java/docs/components/schemas/MapTest.md index 705883f43eb..ce0095504fc 100644 --- a/samples/client/petstore/java/docs/components/schemas/MapTest.md +++ b/samples/client/petstore/java/docs/components/schemas/MapTest.md @@ -79,7 +79,7 @@ MapTest.MapTestMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("map_map_of_string", [MapMapOfString.class](#mapmapofstring))),
        new PropertyEntry("map_of_enum_string", [MapOfEnumString.class](#mapofenumstring))),
        new PropertyEntry("direct_map", [DirectMap.class](#directmap))),
        new PropertyEntry("indirect_map", [StringBooleanMap.StringBooleanMap1.class](../../components/schemas/StringBooleanMap.md#stringbooleanmap1))
    )
| ### Method Summary @@ -151,7 +151,7 @@ MapTest.DirectMapMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties3.class](#additionalproperties3)
| ### Method Summary @@ -225,7 +225,7 @@ MapTest.MapOfEnumStringMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties2.class](#additionalproperties2)
| ### Method Summary @@ -328,7 +328,7 @@ MapTest.MapMapOfStringMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary @@ -392,7 +392,7 @@ MapTest.AdditionalPropertiesMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties1.class](#additionalproperties1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md index 1c67ed5acee..900b14c08b5 100644 --- a/samples/client/petstore/java/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/docs/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.md @@ -67,7 +67,7 @@ MixedPropertiesAndAdditionalPropertiesClass.MixedPropertiesAndAdditionalProperti ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("uuid", [UuidSchema.class](#uuidschema))),
        new PropertyEntry("dateTime", [DateTime.class](#datetime))),
        new PropertyEntry("map", [MapSchema.class](#mapschema)))
    )
| ### Method Summary @@ -136,7 +136,7 @@ MixedPropertiesAndAdditionalPropertiesClass.MapMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [Animal.Animal1.class](../../components/schemas/Animal.md#animal1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Money.md b/samples/client/petstore/java/docs/components/schemas/Money.md index 0e246286ab3..c449f86a79a 100644 --- a/samples/client/petstore/java/docs/components/schemas/Money.md +++ b/samples/client/petstore/java/docs/components/schemas/Money.md @@ -59,7 +59,7 @@ Money.MoneyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("amount", [Amount.class](#amount))),
        new PropertyEntry("currency", [Currency.Currency1.class](../../components/schemas/Currency.md#currency1))
    )
| | Set |     required = Set.of(
        "amount",
        "currency"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/MyObjectDto.md b/samples/client/petstore/java/docs/components/schemas/MyObjectDto.md index 249a1b11ae1..7a637a36e08 100644 --- a/samples/client/petstore/java/docs/components/schemas/MyObjectDto.md +++ b/samples/client/petstore/java/docs/components/schemas/MyObjectDto.md @@ -55,7 +55,7 @@ MyObjectDto.MyObjectDtoMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("id", [Id.class](#id)))
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/NoAdditionalProperties.md b/samples/client/petstore/java/docs/components/schemas/NoAdditionalProperties.md index 164a3bffae3..5d79351def7 100644 --- a/samples/client/petstore/java/docs/components/schemas/NoAdditionalProperties.md +++ b/samples/client/petstore/java/docs/components/schemas/NoAdditionalProperties.md @@ -60,7 +60,7 @@ NoAdditionalProperties.NoAdditionalPropertiesMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("id", [Id.class](#id))),
        new PropertyEntry("petId", [PetId.class](#petid)))
    )
| | Set |     required = Set.of(
        "id"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/NullableClass.md b/samples/client/petstore/java/docs/components/schemas/NullableClass.md index 044e579d522..9b50bb63f8f 100644 --- a/samples/client/petstore/java/docs/components/schemas/NullableClass.md +++ b/samples/client/petstore/java/docs/components/schemas/NullableClass.md @@ -131,7 +131,7 @@ NullableClass.NullableClassMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("integer_prop", [IntegerProp.class](#integerprop))),
        new PropertyEntry("number_prop", [NumberProp.class](#numberprop))),
        new PropertyEntry("boolean_prop", [BooleanProp.class](#booleanprop))),
        new PropertyEntry("string_prop", [StringProp.class](#stringprop))),
        new PropertyEntry("date_prop", [DateProp.class](#dateprop))),
        new PropertyEntry("datetime_prop", [DatetimeProp.class](#datetimeprop))),
        new PropertyEntry("array_nullable_prop", [ArrayNullableProp.class](#arraynullableprop))),
        new PropertyEntry("array_and_items_nullable_prop", [ArrayAndItemsNullableProp.class](#arrayanditemsnullableprop))),
        new PropertyEntry("array_items_nullable", [ArrayItemsNullable.class](#arrayitemsnullable))),
        new PropertyEntry("object_nullable_prop", [ObjectNullableProp.class](#objectnullableprop))),
        new PropertyEntry("object_and_items_nullable_prop", [ObjectAndItemsNullableProp.class](#objectanditemsnullableprop))),
        new PropertyEntry("object_items_nullable", [ObjectItemsNullable.class](#objectitemsnullable)))
    )
| | Class |     additionalProperties = [AdditionalProperties3.class](#additionalproperties3)
| @@ -220,7 +220,7 @@ NullableClass.ObjectItemsNullableMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties2.class](#additionalproperties2)
| ### Method Summary @@ -282,7 +282,7 @@ Void validatedPayload = NullableClass.AdditionalProperties2.validate( ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| ### Method Summary | Modifier and Type | Method and Description | @@ -329,7 +329,7 @@ NullableClass.ObjectAndItemsNullablePropMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| | Class |     additionalProperties = [AdditionalProperties1.class](#additionalproperties1)
| ### Method Summary @@ -392,7 +392,7 @@ Void validatedPayload = NullableClass.AdditionalProperties1.validate( ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| ### Method Summary | Modifier and Type | Method and Description | @@ -439,7 +439,7 @@ NullableClass.ObjectNullablePropMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary @@ -515,7 +515,7 @@ NullableClass.ArrayItemsNullableList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items2.class](#items2)
| ### Method Summary @@ -576,7 +576,7 @@ Void validatedPayload = NullableClass.Items2.validate( ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| ### Method Summary | Modifier and Type | Method and Description | @@ -624,7 +624,7 @@ NullableClass.ArrayAndItemsNullablePropList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenList.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        List.class
    )
| | Class |     items = [Items1.class](#items1)
| ### Method Summary @@ -686,7 +686,7 @@ Void validatedPayload = NullableClass.Items1.validate( ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| ### Method Summary | Modifier and Type | Method and Description | @@ -733,7 +733,7 @@ NullableClass.ArrayNullablePropList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenList.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        List.class
    )
| | Class |     items = [Items.class](#items)
| ### Method Summary @@ -1077,7 +1077,7 @@ Void validatedPayload = NullableClass.AdditionalProperties3.validate( ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/schemas/NumberOnly.md b/samples/client/petstore/java/docs/components/schemas/NumberOnly.md index c9a704f5790..ce6911b99fc 100644 --- a/samples/client/petstore/java/docs/components/schemas/NumberOnly.md +++ b/samples/client/petstore/java/docs/components/schemas/NumberOnly.md @@ -54,7 +54,7 @@ NumberOnly.NumberOnlyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("JustNumber", [JustNumber.class](#justnumber)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ObjWithRequiredProps.md b/samples/client/petstore/java/docs/components/schemas/ObjWithRequiredProps.md index 1b70ece00ad..adca4db0f1b 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjWithRequiredProps.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjWithRequiredProps.md @@ -54,7 +54,7 @@ ObjWithRequiredProps.ObjWithRequiredPropsMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("a", [A.class](#a)))
    )
| | Set |     required = Set.of(
        "a"
    )
| | List> |     allOf = List.of(
        [ObjWithRequiredPropsBase.ObjWithRequiredPropsBase1.class](../../components/schemas/ObjWithRequiredPropsBase.md#objwithrequiredpropsbase1)
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/ObjWithRequiredPropsBase.md b/samples/client/petstore/java/docs/components/schemas/ObjWithRequiredPropsBase.md index 5f82de2794b..0f247fad248 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjWithRequiredPropsBase.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjWithRequiredPropsBase.md @@ -54,7 +54,7 @@ ObjWithRequiredPropsBase.ObjWithRequiredPropsBaseMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("b", [B.class](#b)))
    )
| | Set |     required = Set.of(
        "b"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md b/samples/client/petstore/java/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md index 26cf1f7a982..ff0489ddfb7 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectModelWithArgAndArgsProperties.md @@ -59,7 +59,7 @@ ObjectModelWithArgAndArgsProperties.ObjectModelWithArgAndArgsPropertiesMap valid ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("arg", [Arg.class](#arg))),
        new PropertyEntry("args", [Args.class](#args)))
    )
| | Set |     required = Set.of(
        "arg",
        "args"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectModelWithRefProps.md b/samples/client/petstore/java/docs/components/schemas/ObjectModelWithRefProps.md index e0510a3cefc..4a54340524a 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectModelWithRefProps.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectModelWithRefProps.md @@ -52,7 +52,7 @@ ObjectModelWithRefProps.ObjectModelWithRefPropsMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("myNumber", [NumberWithValidations.NumberWithValidations1.class](../../components/schemas/NumberWithValidations.md#numberwithvalidations1)),
        new PropertyEntry("myString", [StringSchema.StringSchema1.class](../../components/schemas/StringSchema.md#stringschema1)),
        new PropertyEntry("myBoolean", [BooleanSchema.BooleanSchema1.class](../../components/schemas/BooleanSchema.md#booleanschema1))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md index 3db99710a1b..c8b60e5b4e3 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.md @@ -79,7 +79,7 @@ ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("name", [Name.class](#name)))
    )
| | Set |     required = Set.of(
        "test"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithCollidingProperties.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithCollidingProperties.md index 133ea768aea..f90e3956c0d 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithCollidingProperties.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithCollidingProperties.md @@ -54,7 +54,7 @@ ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMap validatedPayload ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("someProp", [SomeProp.class](#someprop))),
        new PropertyEntry("someprop", [Someprop.class](#someprop)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithDecimalProperties.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithDecimalProperties.md index 5214beac312..a685bf6c5a0 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithDecimalProperties.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithDecimalProperties.md @@ -71,7 +71,7 @@ ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("length", [DecimalPayload.DecimalPayload1.class](../../components/schemas/DecimalPayload.md#decimalpayload1)),
        new PropertyEntry("width", [Width.class](#width))),
        new PropertyEntry("cost", [Money.Money1.class](../../components/schemas/Money.md#money1))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithDifficultlyNamedProps.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithDifficultlyNamedProps.md index 44a4c42cbd5..44cdf64ec1a 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithDifficultlyNamedProps.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithDifficultlyNamedProps.md @@ -67,7 +67,7 @@ ObjectWithDifficultlyNamedProps.ObjectWithDifficultlyNamedPropsMap validatedPayl ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("$special[property.name]", [Specialpropertyname.class](#specialpropertyname))),
        new PropertyEntry("123-list", [Schema123list.class](#schema123list))),
        new PropertyEntry("123Number", [Schema123Number.class](#schema123number)))
    )
| | Set |     required = Set.of(
        "123-list"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithInlineCompositionProperty.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithInlineCompositionProperty.md index 1fef2dd7d14..ee35f830eeb 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithInlineCompositionProperty.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithInlineCompositionProperty.md @@ -51,7 +51,7 @@ ObjectWithInlineCompositionProperty.ObjectWithInlineCompositionPropertyMap valid ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("someProp", [SomeProp.class](#someprop)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md index 75b31775a64..8711b4b5c15 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithInvalidNamedRefedProperties.md @@ -68,7 +68,7 @@ ObjectWithInvalidNamedRefedProperties.ObjectWithInvalidNamedRefedPropertiesMap v ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("from", [FromSchema.FromSchema1.class](../../components/schemas/FromSchema.md#fromschema1)),
        new PropertyEntry("!reference", [ArrayWithValidationsInItems.ArrayWithValidationsInItems1.class](../../components/schemas/ArrayWithValidationsInItems.md#arraywithvalidationsinitems1))
    )
| | Set |     required = Set.of(
        "!reference",
        "from"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithNonIntersectingValues.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithNonIntersectingValues.md index fabb95ee11a..8a5ef8ea18c 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithNonIntersectingValues.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithNonIntersectingValues.md @@ -55,7 +55,7 @@ ObjectWithNonIntersectingValues.ObjectWithNonIntersectingValuesMap validatedPayl ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("a", [A.class](#a)))
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithOnlyOptionalProps.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithOnlyOptionalProps.md index 4e0f52a0794..c86b2c5e725 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithOnlyOptionalProps.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithOnlyOptionalProps.md @@ -60,7 +60,7 @@ ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("a", [A.class](#a))),
        new PropertyEntry("b", [B.class](#b)))
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithOptionalTestProp.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithOptionalTestProp.md index b7c1e6e198c..e37585df97f 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithOptionalTestProp.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithOptionalTestProp.md @@ -54,7 +54,7 @@ ObjectWithOptionalTestProp.ObjectWithOptionalTestPropMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("test", [Test.class](#test)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ObjectWithValidations.md b/samples/client/petstore/java/docs/components/schemas/ObjectWithValidations.md index 9fe5ddd7f68..76b832fd2d4 100644 --- a/samples/client/petstore/java/docs/components/schemas/ObjectWithValidations.md +++ b/samples/client/petstore/java/docs/components/schemas/ObjectWithValidations.md @@ -23,7 +23,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Integer |     minProperties = 2
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Order.md b/samples/client/petstore/java/docs/components/schemas/Order.md index 06b53d365eb..83718192c56 100644 --- a/samples/client/petstore/java/docs/components/schemas/Order.md +++ b/samples/client/petstore/java/docs/components/schemas/Order.md @@ -79,7 +79,7 @@ Order.OrderMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("id", [Id.class](#id))),
        new PropertyEntry("petId", [PetId.class](#petid))),
        new PropertyEntry("quantity", [Quantity.class](#quantity))),
        new PropertyEntry("shipDate", [ShipDate.class](#shipdate))),
        new PropertyEntry("status", [Status.class](#status))),
        new PropertyEntry("complete", [Complete.class](#complete)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/PaginatedResultMyObjectDto.md b/samples/client/petstore/java/docs/components/schemas/PaginatedResultMyObjectDto.md index 21fcb8e1e7b..8dc427f36ed 100644 --- a/samples/client/petstore/java/docs/components/schemas/PaginatedResultMyObjectDto.md +++ b/samples/client/petstore/java/docs/components/schemas/PaginatedResultMyObjectDto.md @@ -63,7 +63,7 @@ PaginatedResultMyObjectDto.PaginatedResultMyObjectDtoMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("count", [Count.class](#count))),
        new PropertyEntry("results", [Results.class](#results)))
    )
| | Set |     required = Set.of(
        "count",
        "results"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| @@ -131,7 +131,7 @@ PaginatedResultMyObjectDto.ResultsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [MyObjectDto.MyObjectDto1.class](../../components/schemas/MyObjectDto.md#myobjectdto1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ParentPet.md b/samples/client/petstore/java/docs/components/schemas/ParentPet.md index ced458bef50..cabc4a03559 100644 --- a/samples/client/petstore/java/docs/components/schemas/ParentPet.md +++ b/samples/client/petstore/java/docs/components/schemas/ParentPet.md @@ -23,7 +23,7 @@ A schema class that validates payloads ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | List> |     allOf = List.of(
        [GrandparentAnimal.GrandparentAnimal1.class](../../components/schemas/GrandparentAnimal.md#grandparentanimal1)
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Pet.md b/samples/client/petstore/java/docs/components/schemas/Pet.md index 55a6623dd97..3b565d16223 100644 --- a/samples/client/petstore/java/docs/components/schemas/Pet.md +++ b/samples/client/petstore/java/docs/components/schemas/Pet.md @@ -104,7 +104,7 @@ Pet.PetMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("id", [Id.class](#id))),
        new PropertyEntry("category", [Category.Category1.class](../../components/schemas/Category.md#category1)),
        new PropertyEntry("name", [Name.class](#name))),
        new PropertyEntry("photoUrls", [PhotoUrls.class](#photourls))),
        new PropertyEntry("tags", [Tags.class](#tags))),
        new PropertyEntry("status", [Status.class](#status)))
    )
| | Set |     required = Set.of(
        "name",
        "photoUrls"
    )
| @@ -191,7 +191,7 @@ Pet.TagsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Tag.Tag1.class](../../components/schemas/Tag.md#tag1)
| ### Method Summary @@ -297,7 +297,7 @@ Pet.PhotoUrlsList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Player.md b/samples/client/petstore/java/docs/components/schemas/Player.md index 2e3a744d606..c9785649855 100644 --- a/samples/client/petstore/java/docs/components/schemas/Player.md +++ b/samples/client/petstore/java/docs/components/schemas/Player.md @@ -57,7 +57,7 @@ Player.PlayerMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("name", [Name.class](#name))),
        new PropertyEntry("enemyPlayer", [Player1.class](#player1)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/PublicKey.md b/samples/client/petstore/java/docs/components/schemas/PublicKey.md index d4d9f280509..c3e11c56483 100644 --- a/samples/client/petstore/java/docs/components/schemas/PublicKey.md +++ b/samples/client/petstore/java/docs/components/schemas/PublicKey.md @@ -57,7 +57,7 @@ PublicKey.PublicKeyMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("key", [Key.class](#key)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ReadOnlyFirst.md b/samples/client/petstore/java/docs/components/schemas/ReadOnlyFirst.md index 357980a52aa..c6d0251a403 100644 --- a/samples/client/petstore/java/docs/components/schemas/ReadOnlyFirst.md +++ b/samples/client/petstore/java/docs/components/schemas/ReadOnlyFirst.md @@ -59,7 +59,7 @@ ReadOnlyFirst.ReadOnlyFirstMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("bar", [Bar.class](#bar))),
        new PropertyEntry("baz", [Baz.class](#baz)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ReqPropsFromExplicitAddProps.md b/samples/client/petstore/java/docs/components/schemas/ReqPropsFromExplicitAddProps.md index c79e7882e8c..bf5b53256a1 100644 --- a/samples/client/petstore/java/docs/components/schemas/ReqPropsFromExplicitAddProps.md +++ b/samples/client/petstore/java/docs/components/schemas/ReqPropsFromExplicitAddProps.md @@ -54,7 +54,7 @@ ReqPropsFromExplicitAddProps.ReqPropsFromExplicitAddPropsMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Set |     required = Set.of(
        "invalid-name",
        "validName"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/ReqPropsFromTrueAddProps.md b/samples/client/petstore/java/docs/components/schemas/ReqPropsFromTrueAddProps.md index 97c5c856661..4eb218c1d08 100644 --- a/samples/client/petstore/java/docs/components/schemas/ReqPropsFromTrueAddProps.md +++ b/samples/client/petstore/java/docs/components/schemas/ReqPropsFromTrueAddProps.md @@ -50,7 +50,7 @@ ReqPropsFromTrueAddProps.ReqPropsFromTrueAddPropsMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Set |     required = Set.of(
        "invalid-name",
        "validName"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/components/schemas/ReqPropsFromUnsetAddProps.md b/samples/client/petstore/java/docs/components/schemas/ReqPropsFromUnsetAddProps.md index 8c77e3a4c22..8125d46acff 100644 --- a/samples/client/petstore/java/docs/components/schemas/ReqPropsFromUnsetAddProps.md +++ b/samples/client/petstore/java/docs/components/schemas/ReqPropsFromUnsetAddProps.md @@ -49,7 +49,7 @@ ReqPropsFromUnsetAddProps.ReqPropsFromUnsetAddPropsMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Set |     required = Set.of(
        "invalid-name",
        "validName"
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/ScaleneTriangle.md b/samples/client/petstore/java/docs/components/schemas/ScaleneTriangle.md index 1b6e1e3f94d..e6ad753e12d 100644 --- a/samples/client/petstore/java/docs/components/schemas/ScaleneTriangle.md +++ b/samples/client/petstore/java/docs/components/schemas/ScaleneTriangle.md @@ -79,7 +79,7 @@ ScaleneTriangle.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("triangleType", [TriangleType.class](#triangletype)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/SelfReferencingArrayModel.md b/samples/client/petstore/java/docs/components/schemas/SelfReferencingArrayModel.md index 7246af36d9e..8e5357d4c19 100644 --- a/samples/client/petstore/java/docs/components/schemas/SelfReferencingArrayModel.md +++ b/samples/client/petstore/java/docs/components/schemas/SelfReferencingArrayModel.md @@ -49,7 +49,7 @@ SelfReferencingArrayModel.SelfReferencingArrayModelList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [SelfReferencingArrayModel1.class](#selfreferencingarraymodel1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/SelfReferencingObjectModel.md b/samples/client/petstore/java/docs/components/schemas/SelfReferencingObjectModel.md index 762ebc32a31..b131aade7a3 100644 --- a/samples/client/petstore/java/docs/components/schemas/SelfReferencingObjectModel.md +++ b/samples/client/petstore/java/docs/components/schemas/SelfReferencingObjectModel.md @@ -49,7 +49,7 @@ SelfReferencingObjectModel.SelfReferencingObjectModelMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("selfRef", [SelfReferencingObjectModel1.class](#selfreferencingobjectmodel1)))
    )
| | Class |     additionalProperties = [SelfReferencingObjectModel1.class](#selfreferencingobjectmodel1)
| diff --git a/samples/client/petstore/java/docs/components/schemas/SimpleQuadrilateral.md b/samples/client/petstore/java/docs/components/schemas/SimpleQuadrilateral.md index 043567a39c1..372a48419ee 100644 --- a/samples/client/petstore/java/docs/components/schemas/SimpleQuadrilateral.md +++ b/samples/client/petstore/java/docs/components/schemas/SimpleQuadrilateral.md @@ -79,7 +79,7 @@ SimpleQuadrilateral.Schema1Map validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("quadrilateralType", [QuadrilateralType.class](#quadrilateraltype)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/SpecialModelname.md b/samples/client/petstore/java/docs/components/schemas/SpecialModelname.md index 0a99ea6392f..6dd64730d6d 100644 --- a/samples/client/petstore/java/docs/components/schemas/SpecialModelname.md +++ b/samples/client/petstore/java/docs/components/schemas/SpecialModelname.md @@ -57,7 +57,7 @@ SpecialModelname.SpecialModelnameMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("a", [A.class](#a)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/StringBooleanMap.md b/samples/client/petstore/java/docs/components/schemas/StringBooleanMap.md index af524541913..95546611e28 100644 --- a/samples/client/petstore/java/docs/components/schemas/StringBooleanMap.md +++ b/samples/client/petstore/java/docs/components/schemas/StringBooleanMap.md @@ -50,7 +50,7 @@ StringBooleanMap.StringBooleanMapMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/Tag.md b/samples/client/petstore/java/docs/components/schemas/Tag.md index 4ac15b4dd85..76c33dcd1be 100644 --- a/samples/client/petstore/java/docs/components/schemas/Tag.md +++ b/samples/client/petstore/java/docs/components/schemas/Tag.md @@ -59,7 +59,7 @@ Tag.TagMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("id", [Id.class](#id))),
        new PropertyEntry("name", [Name.class](#name)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/components/schemas/User.md b/samples/client/petstore/java/docs/components/schemas/User.md index e97e7bff0f2..fc3f9686e12 100644 --- a/samples/client/petstore/java/docs/components/schemas/User.md +++ b/samples/client/petstore/java/docs/components/schemas/User.md @@ -99,7 +99,7 @@ User.UserMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("id", [Id.class](#id))),
        new PropertyEntry("username", [Username.class](#username))),
        new PropertyEntry("firstName", [FirstName.class](#firstname))),
        new PropertyEntry("lastName", [LastName.class](#lastname))),
        new PropertyEntry("email", [Email.class](#email))),
        new PropertyEntry("password", [Password.class](#password))),
        new PropertyEntry("phone", [Phone.class](#phone))),
        new PropertyEntry("userStatus", [UserStatus.class](#userstatus))),
        new PropertyEntry("objectWithNoDeclaredProps", [ObjectWithNoDeclaredProps.class](#objectwithnodeclaredprops))),
        new PropertyEntry("objectWithNoDeclaredPropsNullable", [ObjectWithNoDeclaredPropsNullable.class](#objectwithnodeclaredpropsnullable))),
        new PropertyEntry("anyTypeProp", [AnyTypeProp.class](#anytypeprop))),
        new PropertyEntry("anyTypeExceptNullProp", [AnyTypeExceptNullProp.class](#anytypeexceptnullprop))),
        new PropertyEntry("anyTypePropNullable", [AnyTypePropNullable.class](#anytypepropnullable)))
    )
| ### Method Summary @@ -253,7 +253,7 @@ Void validatedPayload = User.ObjectWithNoDeclaredPropsNullable.validate( ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(
        Void.class,
        FrozenMap.class
    )
| +| Set> |     type = Set.of(
        Void.class,
        Map.class
    )
| ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/schemas/Whale.md b/samples/client/petstore/java/docs/components/schemas/Whale.md index 8302e482360..926ba01ea9b 100644 --- a/samples/client/petstore/java/docs/components/schemas/Whale.md +++ b/samples/client/petstore/java/docs/components/schemas/Whale.md @@ -64,7 +64,7 @@ Whale.WhaleMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("hasBaleen", [HasBaleen.class](#hasbaleen))),
        new PropertyEntry("hasTeeth", [HasTeeth.class](#hasteeth))),
        new PropertyEntry("className", [ClassName.class](#classname)))
    )
| | Set |     required = Set.of(
        "className"
    )
| diff --git a/samples/client/petstore/java/docs/components/schemas/Zebra.md b/samples/client/petstore/java/docs/components/schemas/Zebra.md index eee5b7c2a68..719dacd7995 100644 --- a/samples/client/petstore/java/docs/components/schemas/Zebra.md +++ b/samples/client/petstore/java/docs/components/schemas/Zebra.md @@ -60,7 +60,7 @@ Zebra.ZebraMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("type", [Type.class](#type))),
        new PropertyEntry("className", [ClassName.class](#classname)))
    )
| | Set |     required = Set.of(
        "className"
    )
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| diff --git a/samples/client/petstore/java/docs/paths/fake/get/parameters/parameter0/Schema0.md b/samples/client/petstore/java/docs/paths/fake/get/parameters/parameter0/Schema0.md index 5313216702d..48e3350577c 100644 --- a/samples/client/petstore/java/docs/paths/fake/get/parameters/parameter0/Schema0.md +++ b/samples/client/petstore/java/docs/paths/fake/get/parameters/parameter0/Schema0.md @@ -51,7 +51,7 @@ Schema0.SchemaList0 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items0.class](#items0)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fake/get/parameters/parameter2/Schema2.md b/samples/client/petstore/java/docs/paths/fake/get/parameters/parameter2/Schema2.md index 548e6c9423a..a03bd5283ea 100644 --- a/samples/client/petstore/java/docs/paths/fake/get/parameters/parameter2/Schema2.md +++ b/samples/client/petstore/java/docs/paths/fake/get/parameters/parameter2/Schema2.md @@ -51,7 +51,7 @@ Schema2.SchemaList2 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items2.class](#items2)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/Schema.md b/samples/client/petstore/java/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/Schema.md index e6565e1d603..d944670326d 100644 --- a/samples/client/petstore/java/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/Schema.md +++ b/samples/client/petstore/java/docs/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/Schema.md @@ -64,7 +64,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("enum_form_string_array", [EnumFormStringArray.class](#enumformstringarray))),
        new PropertyEntry("enum_form_string", [EnumFormString.class](#enumformstring)))
    )
| ### Method Summary @@ -178,7 +178,7 @@ Schema.EnumFormStringArrayList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/Schema.md b/samples/client/petstore/java/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/Schema.md index ec9296544d4..5b6e1ee1542 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/Schema.md +++ b/samples/client/petstore/java/docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/Schema.md @@ -119,7 +119,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("integer", [IntegerSchema.class](#integerschema))),
        new PropertyEntry("int32", [Int32.class](#int32))),
        new PropertyEntry("int64", [Int64.class](#int64))),
        new PropertyEntry("number", [NumberSchema.class](#numberschema))),
        new PropertyEntry("float", [FloatSchema.class](#floatschema))),
        new PropertyEntry("double", [DoubleSchema.class](#doubleschema))),
        new PropertyEntry("string", [StringSchema.class](#stringschema))),
        new PropertyEntry("pattern_without_delimiter", [PatternWithoutDelimiter.class](#patternwithoutdelimiter))),
        new PropertyEntry("byte", [ByteSchema.class](#byteschema))),
        new PropertyEntry("binary", [Binary.class](#binary))),
        new PropertyEntry("date", [Date.class](#date))),
        new PropertyEntry("dateTime", [DateTime.class](#datetime))),
        new PropertyEntry("password", [Password.class](#password))),
        new PropertyEntry("callback", [Callback.class](#callback)))
    )
| | Set |     required = Set.of(
        "byte",
        "double",
        "number",
        "pattern_without_delimiter"
    )
| diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/Schema.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/Schema.md index 4fe7c2d966b..6091f2a5815 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/Schema.md @@ -50,7 +50,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Class |     additionalProperties = [AdditionalProperties.class](#additionalproperties)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md index ef8a93de87d..e7cfa9aead6 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.md @@ -51,7 +51,7 @@ Schema1.SchemaMap1 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("someProp", [SomeProp1.class](#someprop1)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/Schema.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/Schema.md index 52b50b80069..9afe3d0ffb9 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/Schema.md @@ -51,7 +51,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("someProp", [SomeProp.class](#someprop)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/responses/response200/content/multipartformdata/Schema.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/responses/response200/content/multipartformdata/Schema.md index 71423bca140..cdf4fcde9b2 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/responses/response200/content/multipartformdata/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/responses/response200/content/multipartformdata/Schema.md @@ -51,7 +51,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("someProp", [SomeProp.class](#someprop)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/Schema.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/Schema.md index e6cbecd0f6f..0e9a6700b90 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/Schema.md @@ -59,7 +59,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("param", [Param.class](#param))),
        new PropertyEntry("param2", [Param2.class](#param2)))
    )
| | Set |     required = Set.of(
        "param",
        "param2"
    )
| diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/Schema.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/Schema.md index a8d7020d92e..cd1fc5b6e17 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/Schema.md @@ -54,7 +54,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("a", [A.class](#a)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/Schema.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/Schema.md index 844fd53de93..68854d328f6 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/Schema.md @@ -54,7 +54,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("b", [B.class](#b)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md index 327395961c2..3de5a83d0e1 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/get/parameters/parameter0/Schema0.md @@ -54,7 +54,7 @@ Schema0.SchemaMap0 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("keyword", [Keyword0.class](#keyword0)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.md index c1342fa5f77..fed7bb7b4b2 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.md @@ -59,7 +59,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("additionalMetadata", [AdditionalMetadata.class](#additionalmetadata))),
        new PropertyEntry("requiredFile", [RequiredFile.class](#requiredfile)))
    )
| | Set |     required = Set.of(
        "requiredFile"
    )
| diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md index 32431531ccf..a04c2f3c13a 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.md @@ -51,7 +51,7 @@ Schema0.SchemaList0 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items0.class](#items0)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md index 38acc00dcb4..411fbc66572 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.md @@ -51,7 +51,7 @@ Schema1.SchemaList1 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items1.class](#items1)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md index 56538acd533..3644d7bf578 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.md @@ -51,7 +51,7 @@ Schema2.SchemaList2 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items2.class](#items2)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md index d1e6aa277b1..e8bc4be3581 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.md @@ -51,7 +51,7 @@ Schema3.SchemaList3 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items3.class](#items3)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md index 6cb9305d4e6..0928276aaaa 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.md @@ -51,7 +51,7 @@ Schema4.SchemaList4 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items4.class](#items4)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/Schema.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/Schema.md index 51cd779b9a9..048846c7956 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/post/requestbody/content/multipartformdata/Schema.md @@ -59,7 +59,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("additionalMetadata", [AdditionalMetadata.class](#additionalmetadata))),
        new PropertyEntry("file", [File.class](#file)))
    )
| | Set |     required = Set.of(
        "file"
    )
| diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/Schema.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/Schema.md index 31db2ead20b..dfed5d9118b 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/Schema.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/Schema.md @@ -59,7 +59,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("files", [Files.class](#files)))
    )
| ### Method Summary @@ -126,7 +126,7 @@ Schema.FilesList validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items.class](#items)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/foo/get/responses/responsedefault/content/applicationjson/Schema.md b/samples/client/petstore/java/docs/paths/foo/get/responses/responsedefault/content/applicationjson/Schema.md index 65f0d65cf44..c3f9ea1d90e 100644 --- a/samples/client/petstore/java/docs/paths/foo/get/responses/responsedefault/content/applicationjson/Schema.md +++ b/samples/client/petstore/java/docs/paths/foo/get/responses/responsedefault/content/applicationjson/Schema.md @@ -58,7 +58,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("string", [Foo.Foo1.class](../../../../../../../../components/schemas/Foo.md#foo1))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md index 0578d6bf49f..43e87ed3268 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md @@ -51,7 +51,7 @@ Schema0.SchemaList0 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items0.class](#items0)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md index 6c225b10cbf..a6b13269861 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md @@ -51,7 +51,7 @@ Schema0.SchemaList0 validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenList.class)
| +| Set> |     type = Set.of(List.class)
| | Class |     items = [Items0.class](#items0)
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/Schema.md b/samples/client/petstore/java/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/Schema.md index 9352bd82cce..5dbb027bf58 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/Schema.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/Schema.md @@ -59,7 +59,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("name", [Name.class](#name))),
        new PropertyEntry("status", [Status.class](#status)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/Schema.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/Schema.md index a97f7796551..96091d50b65 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/Schema.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/Schema.md @@ -59,7 +59,7 @@ Schema.SchemaMap validatedPayload = ### Field Summary | Modifier and Type | Field and Description | | ----------------- | ---------------------- | -| Set> |     type = Set.of(FrozenMap.class)
| +| Set> |     type = Set.of(Map.class)
| | Map> |     properties = Map.ofEntries(
        new PropertyEntry("additionalMetadata", [AdditionalMetadata.class](#additionalmetadata))),
        new PropertyEntry("file", [File.class](#file)))
    )
| ### Method Summary diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/Schema.java index 8b5ed59469b..b45419a2633 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/Schema.java @@ -38,12 +38,12 @@ public static class SchemaListInput { } - public static class Schema1 extends JsonSchema implements ListSchemaValidator, FrozenMap, SchemaList> { + public static class Schema1 extends JsonSchema implements ListSchemaValidator, SchemaList> { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(User.User1.class) ); } @@ -56,29 +56,14 @@ public static Schema1 getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - User.UserMap castItem = (User.UserMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + User.UserMap castItem = (User.UserMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -90,7 +75,7 @@ public SchemaList getNewInstance(FrozenList> arg, List public SchemaList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -99,9 +84,8 @@ public SchemaList validate(List> arg, SchemaConfiguration co @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.java index 32fdf72efae..f0c78577499 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/Headers.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,12 +53,12 @@ public static class HeadersMapInput { } - public static class Headers1 extends JsonSchema implements MapSchemaValidator { + public static class Headers1 extends JsonSchema implements MapSchemaValidator { private static Headers1 instance; protected Headers1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("location", LocationSchema.LocationSchema1.class) )) @@ -74,28 +73,13 @@ public static Headers1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeadersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeadersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -108,7 +92,7 @@ public HeadersMap getNewInstance(FrozenMap arg, List pathToItem, public HeadersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -118,9 +102,8 @@ public HeadersMap validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/Schema.java index f2d0ac9d8ee..47e99e88fd4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/Schema.java @@ -39,12 +39,12 @@ public static class SchemaListInput { } - public static class Schema1 extends JsonSchema implements ListSchemaValidator, FrozenMap, SchemaList> { + public static class Schema1 extends JsonSchema implements ListSchemaValidator, SchemaList> { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(RefPet.RefPet1.class) ); } @@ -57,29 +57,14 @@ public static Schema1 getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Pet.PetMap castItem = (Pet.PetMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Pet.PetMap castItem = (Pet.PetMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -91,7 +76,7 @@ public SchemaList getNewInstance(FrozenList> arg, List public SchemaList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -100,9 +85,8 @@ public SchemaList validate(List> arg, SchemaConfiguration co @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/Schema.java index 87e64019f1f..ce02b7f40ff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/Schema.java @@ -38,12 +38,12 @@ public static class SchemaListInput { } - public static class Schema1 extends JsonSchema implements ListSchemaValidator, FrozenMap, SchemaList> { + public static class Schema1 extends JsonSchema implements ListSchemaValidator, SchemaList> { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Pet.Pet1.class) ); } @@ -56,29 +56,14 @@ public static Schema1 getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Pet.PetMap castItem = (Pet.PetMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Pet.PetMap castItem = (Pet.PetMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -90,7 +75,7 @@ public SchemaList getNewInstance(FrozenList> arg, List public SchemaList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -99,9 +84,8 @@ public SchemaList validate(List> arg, SchemaConfiguration co @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.java index 7124ea52481..2aa762c240d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/Headers.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,12 +53,12 @@ public static class HeadersMapInput { } - public static class Headers1 extends JsonSchema implements MapSchemaValidator { + public static class Headers1 extends JsonSchema implements MapSchemaValidator { private static Headers1 instance; protected Headers1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someHeader", SomeHeaderSchema.SomeHeaderSchema1.class) )) @@ -74,28 +73,13 @@ public static Headers1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeadersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeadersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -108,7 +92,7 @@ public HeadersMap getNewInstance(FrozenMap arg, List pathToItem, public HeadersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -118,9 +102,8 @@ public HeadersMap validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/Schema.java index 864aef5616b..4fc9edac723 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/Schema.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.Int32JsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -47,12 +46,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties.class) ); } @@ -64,28 +63,13 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Integer val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Integer fixedVal = (Integer) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Integer value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Integer castValue = (Integer) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -98,7 +82,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -108,9 +92,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.java index dbff5d62288..68cc43df54f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/Headers.java @@ -17,7 +17,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -70,12 +69,12 @@ public static class HeadersMapInput { } - public static class Headers1 extends JsonSchema implements MapSchemaValidator { + public static class Headers1 extends JsonSchema implements MapSchemaValidator { private static Headers1 instance; protected Headers1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("ref-schema-header", StringWithValidation.StringWithValidation1.class), new PropertyEntry("int32", Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class), @@ -100,25 +99,10 @@ public static Headers1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeadersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeadersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -134,7 +118,7 @@ public HeadersMap getNewInstance(FrozenMap arg, List pathToItem, public HeadersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -144,9 +128,8 @@ public HeadersMap validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java index 0af36231daf..f403a215206 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java @@ -64,7 +64,7 @@ public static class AbstractStepMessageMapInput { } - public static class AbstractStepMessage1 extends JsonSchema implements MapSchemaValidator { + public static class AbstractStepMessage1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -77,7 +77,7 @@ public static class AbstractStepMessage1 extends JsonSchema implements MapSchema protected AbstractStepMessage1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("discriminator", Discriminator.class) )) @@ -99,25 +99,10 @@ public static AbstractStepMessage1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AbstractStepMessageMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AbstractStepMessageMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -133,7 +118,7 @@ public AbstractStepMessageMap getNewInstance(FrozenMap arg, List public AbstractStepMessageMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -143,9 +128,8 @@ public AbstractStepMessageMap validate(Map arg, SchemaConfigurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java index a095024b600..159b2d48f9c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -51,12 +50,12 @@ public static class MapPropertyMapInput { } - public static class MapProperty extends JsonSchema implements MapSchemaValidator { + public static class MapProperty extends JsonSchema implements MapSchemaValidator { private static MapProperty instance; protected MapProperty() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties.class) ); } @@ -68,28 +67,13 @@ public static MapProperty getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MapPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -102,7 +86,7 @@ public MapPropertyMap getNewInstance(FrozenMap arg, List pathToI public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -112,9 +96,8 @@ public MapPropertyMap validate(Map arg, SchemaConfiguration conf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -144,12 +127,12 @@ public static class AdditionalPropertiesMapInput { } - public static class AdditionalProperties1 extends JsonSchema implements MapSchemaValidator { + public static class AdditionalProperties1 extends JsonSchema implements MapSchemaValidator { private static AdditionalProperties1 instance; protected AdditionalProperties1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties2.class) ); } @@ -161,28 +144,13 @@ public static AdditionalProperties1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AdditionalPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -195,7 +163,7 @@ public AdditionalPropertiesMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -205,9 +173,8 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfigura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -234,12 +201,12 @@ public static class MapOfMapPropertyMapInput { } - public static class MapOfMapProperty extends JsonSchema implements MapSchemaValidator, FrozenMap, MapOfMapPropertyMap> { + public static class MapOfMapProperty extends JsonSchema implements MapSchemaValidator, MapOfMapPropertyMap> { private static MapOfMapProperty instance; protected MapOfMapProperty() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties1.class) ); } @@ -251,28 +218,13 @@ public static MapOfMapProperty getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - Map val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MapOfMapPropertyMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenMap value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); AdditionalPropertiesMap castValue = (AdditionalPropertiesMap) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -285,7 +237,7 @@ public MapOfMapPropertyMap getNewInstance(FrozenMap> arg, List public MapOfMapPropertyMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -295,9 +247,8 @@ public MapOfMapPropertyMap validate(Map> arg, Schema @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -336,12 +287,12 @@ public static class MapWithUndeclaredPropertiesAnytype3MapInput { } - public static class MapWithUndeclaredPropertiesAnytype3 extends JsonSchema implements MapSchemaValidator { + public static class MapWithUndeclaredPropertiesAnytype3 extends JsonSchema implements MapSchemaValidator { private static MapWithUndeclaredPropertiesAnytype3 instance; protected MapWithUndeclaredPropertiesAnytype3() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties3.class) ); } @@ -353,25 +304,10 @@ public static MapWithUndeclaredPropertiesAnytype3 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -387,7 +323,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(FrozenMap a public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -397,9 +333,8 @@ public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -426,12 +361,12 @@ public static class EmptyMapMapInput { } - public static class EmptyMap extends JsonSchema implements MapSchemaValidator { + public static class EmptyMap extends JsonSchema implements MapSchemaValidator { private static EmptyMap instance; protected EmptyMap() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties4.class) ); } @@ -443,25 +378,10 @@ public static EmptyMap getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public EmptyMapMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -477,7 +397,7 @@ public EmptyMapMap getNewInstance(FrozenMap arg, List pathToItem public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -487,9 +407,8 @@ public EmptyMapMap validate(Map arg, SchemaConfiguration configu @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -519,12 +438,12 @@ public static class MapWithUndeclaredPropertiesStringMapInput { } - public static class MapWithUndeclaredPropertiesString extends JsonSchema implements MapSchemaValidator { + public static class MapWithUndeclaredPropertiesString extends JsonSchema implements MapSchemaValidator { private static MapWithUndeclaredPropertiesString instance; protected MapWithUndeclaredPropertiesString() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties5.class) ); } @@ -536,28 +455,13 @@ public static MapWithUndeclaredPropertiesString getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MapWithUndeclaredPropertiesStringMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -570,7 +474,7 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(FrozenMap arg public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -580,9 +484,8 @@ public MapWithUndeclaredPropertiesStringMap validate(Map arg, Sc @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -667,7 +570,7 @@ public static class AdditionalPropertiesClassMapInput { } - public static class AdditionalPropertiesClass1 extends JsonSchema implements MapSchemaValidator { + public static class AdditionalPropertiesClass1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -678,7 +581,7 @@ public static class AdditionalPropertiesClass1 extends JsonSchema implements Map protected AdditionalPropertiesClass1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("map_property", MapProperty.class), new PropertyEntry("map_of_map_property", MapOfMapProperty.class), @@ -699,25 +602,10 @@ public static AdditionalPropertiesClass1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AdditionalPropertiesClassMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -733,7 +621,7 @@ public AdditionalPropertiesClassMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -743,9 +631,8 @@ public AdditionalPropertiesClassMap validate(Map arg, SchemaConf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java index 139362881cf..6a2adc664fa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -56,12 +55,12 @@ public static class Schema0MapInput { } - public static class Schema0 extends JsonSchema implements MapSchemaValidator { + public static class Schema0 extends JsonSchema implements MapSchemaValidator { private static Schema0 instance; protected Schema0() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties.class) ); } @@ -73,25 +72,10 @@ public static Schema0 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -107,7 +91,7 @@ public Schema0Map getNewInstance(FrozenMap arg, List pathToItem, public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -117,16 +101,15 @@ public Schema0Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class AdditionalProperties1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AdditionalProperties1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static AdditionalProperties1 instance; protected AdditionalProperties1() { @@ -141,15 +124,6 @@ public static AdditionalProperties1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -160,18 +134,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -183,18 +147,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -206,8 +160,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -226,16 +180,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -245,8 +189,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -262,46 +206,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -309,7 +253,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -328,12 +272,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -359,12 +301,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties1.class) ); } @@ -376,25 +318,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -410,7 +337,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -420,16 +347,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class AdditionalProperties2 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AdditionalProperties2 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static AdditionalProperties2 instance; protected AdditionalProperties2() { @@ -444,15 +370,6 @@ public static AdditionalProperties2 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -463,18 +380,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -486,18 +393,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -509,8 +406,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -529,16 +426,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -548,8 +435,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -565,46 +452,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -612,7 +499,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -631,12 +518,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -662,12 +547,12 @@ public static class Schema2MapInput { } - public static class Schema2 extends JsonSchema implements MapSchemaValidator { + public static class Schema2 extends JsonSchema implements MapSchemaValidator { private static Schema2 instance; protected Schema2() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties2.class) ); } @@ -679,25 +564,10 @@ public static Schema2 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema2Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema2Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -713,7 +583,7 @@ public Schema2Map getNewInstance(FrozenMap arg, List pathToItem, public Schema2Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -723,16 +593,15 @@ public Schema2Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class AdditionalPropertiesSchema1 extends JsonSchema implements MapSchemaValidator> { + public static class AdditionalPropertiesSchema1 extends JsonSchema implements MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -743,7 +612,7 @@ public static class AdditionalPropertiesSchema1 extends JsonSchema implements Ma protected AdditionalPropertiesSchema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .allOf(List.of( Schema0.class, Schema1.class, @@ -759,31 +628,26 @@ public static AdditionalPropertiesSchema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -793,9 +657,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java index 5f9b59267f5..2e21fe5658a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -39,12 +38,12 @@ public static class AdditionalPropertiesListInput { } - public static class AdditionalProperties extends JsonSchema implements ListSchemaValidator { + public static class AdditionalProperties extends JsonSchema implements ListSchemaValidator { private static AdditionalProperties instance; protected AdditionalProperties() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(EnumClass.EnumClass1.class) ); } @@ -57,29 +56,14 @@ public static AdditionalProperties getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public AdditionalPropertiesList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public AdditionalPropertiesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -91,7 +75,7 @@ public AdditionalPropertiesList getNewInstance(FrozenList arg, List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -100,9 +84,8 @@ public AdditionalPropertiesList validate(List arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -128,7 +111,7 @@ public static class AdditionalPropertiesWithArrayOfEnumsMapInput { } - public static class AdditionalPropertiesWithArrayOfEnums1 extends JsonSchema implements MapSchemaValidator, FrozenList, AdditionalPropertiesWithArrayOfEnumsMap> { + public static class AdditionalPropertiesWithArrayOfEnums1 extends JsonSchema implements MapSchemaValidator, AdditionalPropertiesWithArrayOfEnumsMap> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -139,7 +122,7 @@ public static class AdditionalPropertiesWithArrayOfEnums1 extends JsonSchema imp protected AdditionalPropertiesWithArrayOfEnums1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties.class) ); } @@ -151,28 +134,13 @@ public static AdditionalPropertiesWithArrayOfEnums1 getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - List val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenList fixedVal = (FrozenList) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenList value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); AdditionalPropertiesList castValue = (AdditionalPropertiesList) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -185,7 +153,7 @@ public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(FrozenMap> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -195,9 +163,8 @@ public AdditionalPropertiesWithArrayOfEnumsMap validate(Map @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java index 1a294ddcd5a..7a42caf6ca1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -47,7 +46,7 @@ public static class AddressMapInput { } - public static class Address1 extends JsonSchema implements MapSchemaValidator { + public static class Address1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -58,7 +57,7 @@ public static class Address1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Long val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Long fixedVal = (Long) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AddressMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AddressMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Long value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Long castValue = (Long) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -104,7 +88,7 @@ public AddressMap getNewInstance(FrozenMap arg, List pathToItem, P public AddressMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -114,9 +98,8 @@ public AddressMap validate(Map arg, SchemaConfiguration configurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java index cc41d7cfe21..9c184af6d1b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java @@ -46,16 +46,6 @@ public static Color getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,8 +53,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -111,7 +101,7 @@ public static class AnimalMapInput { } - public static class Animal1 extends JsonSchema implements MapSchemaValidator { + public static class Animal1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -122,7 +112,7 @@ public static class Animal1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AnimalMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -174,7 +149,7 @@ public AnimalMap getNewInstance(FrozenMap arg, List pathToItem, public AnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -184,9 +159,8 @@ public AnimalMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java index 8a38adc0731..b720ac450bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java @@ -37,7 +37,7 @@ public static class AnimalFarmListInput { } - public static class AnimalFarm1 extends JsonSchema implements ListSchemaValidator, FrozenMap, AnimalFarmList> { + public static class AnimalFarm1 extends JsonSchema implements ListSchemaValidator, AnimalFarmList> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -48,7 +48,7 @@ public static class AnimalFarm1 extends JsonSchema implements ListSchemaValidato protected AnimalFarm1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Animal.Animal1.class) ); } @@ -61,29 +61,14 @@ public static AnimalFarm1 getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public AnimalFarmList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public AnimalFarmList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Animal.AnimalMap castItem = (Animal.AnimalMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Animal.AnimalMap castItem = (Animal.AnimalMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -95,7 +80,7 @@ public AnimalFarmList getNewInstance(FrozenList> arg, List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -104,9 +89,8 @@ public AnimalFarmList validate(List> arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java index 27cdeaf48bc..43cc400f9bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java @@ -32,7 +32,7 @@ public class AnyTypeAndFormat { // nest classes so all schemas and input/output classes can be public - public static class UuidSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class UuidSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static UuidSchema instance; protected UuidSchema() { @@ -47,15 +47,6 @@ public static UuidSchema getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -66,18 +57,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -89,18 +70,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -112,8 +83,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -132,16 +103,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -151,8 +112,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -168,46 +129,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -215,7 +176,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -234,18 +195,16 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Date extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Date extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Date instance; protected Date() { @@ -260,15 +219,6 @@ public static Date getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -279,18 +229,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -302,18 +242,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -325,8 +255,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -345,16 +275,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -364,8 +284,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -381,46 +301,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -428,7 +348,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -447,18 +367,16 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Datetime extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Datetime extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Datetime instance; protected Datetime() { @@ -473,15 +391,6 @@ public static Datetime getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -492,18 +401,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -515,18 +414,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -538,8 +427,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -558,16 +447,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -577,8 +456,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -594,46 +473,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -641,7 +520,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -660,18 +539,16 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class NumberSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class NumberSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static NumberSchema instance; protected NumberSchema() { @@ -686,15 +563,6 @@ public static NumberSchema getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -705,18 +573,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -728,18 +586,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -751,8 +599,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -771,16 +619,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -790,8 +628,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -807,46 +645,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -854,7 +692,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -873,18 +711,16 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Binary extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Binary extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Binary instance; protected Binary() { @@ -899,15 +735,6 @@ public static Binary getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -918,18 +745,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -941,18 +758,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -964,8 +771,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -984,16 +791,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -1003,8 +800,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -1020,46 +817,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -1067,7 +864,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -1086,18 +883,16 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Int32 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Int32 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Int32 instance; protected Int32() { @@ -1112,15 +907,6 @@ public static Int32 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1131,18 +917,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -1154,18 +930,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -1177,8 +943,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -1197,16 +963,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -1216,8 +972,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -1233,46 +989,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -1280,7 +1036,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -1299,18 +1055,16 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Int64 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Int64 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Int64 instance; protected Int64() { @@ -1325,15 +1079,6 @@ public static Int64 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1344,18 +1089,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -1367,18 +1102,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -1390,8 +1115,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -1410,16 +1135,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -1429,8 +1144,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -1446,46 +1161,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -1493,7 +1208,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -1512,18 +1227,16 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class DoubleSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class DoubleSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static DoubleSchema instance; protected DoubleSchema() { @@ -1538,15 +1251,6 @@ public static DoubleSchema getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1557,18 +1261,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -1580,18 +1274,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -1603,8 +1287,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -1623,16 +1307,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -1642,8 +1316,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -1659,46 +1333,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -1706,7 +1380,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -1725,18 +1399,16 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class FloatSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class FloatSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static FloatSchema instance; protected FloatSchema() { @@ -1751,15 +1423,6 @@ public static FloatSchema getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1770,18 +1433,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -1793,18 +1446,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -1816,8 +1459,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -1836,16 +1479,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -1855,8 +1488,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -1872,46 +1505,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -1919,7 +1552,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -1938,12 +1571,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -2004,7 +1635,7 @@ public static class AnyTypeAndFormatMapInput { } - public static class AnyTypeAndFormat1 extends JsonSchema implements MapSchemaValidator { + public static class AnyTypeAndFormat1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -2015,7 +1646,7 @@ public static class AnyTypeAndFormat1 extends JsonSchema implements MapSchemaVal protected AnyTypeAndFormat1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("uuid", UuidSchema.class), new PropertyEntry("date", Date.class), @@ -2037,25 +1668,10 @@ public static AnyTypeAndFormat1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AnyTypeAndFormatMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -2071,7 +1687,7 @@ public AnyTypeAndFormatMap getNewInstance(FrozenMap arg, List pa public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -2081,9 +1697,8 @@ public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java index f3d13385164..336431c6e63 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java @@ -35,7 +35,7 @@ public class AnyTypeNotString { public static class Not extends StringJsonSchema {} - public static class AnyTypeNotString1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AnyTypeNotString1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -56,15 +56,6 @@ public static AnyTypeNotString1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -75,18 +66,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -98,18 +79,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -121,8 +92,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -141,16 +112,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -160,8 +121,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -177,46 +138,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -224,7 +185,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -243,12 +204,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java index e3fdacd31dc..179b69891c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java @@ -77,7 +77,7 @@ public static class ApiResponseMapInput { } - public static class ApiResponseSchema1 extends JsonSchema implements MapSchemaValidator { + public static class ApiResponseSchema1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -88,7 +88,7 @@ public static class ApiResponseSchema1 extends JsonSchema implements MapSchemaVa protected ApiResponseSchema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("code", Code.class), new PropertyEntry("type", Type.class), @@ -104,25 +104,10 @@ public static ApiResponseSchema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ApiResponseMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApiResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -138,7 +123,7 @@ public ApiResponseMap getNewInstance(FrozenMap arg, List pathToI public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -148,9 +133,8 @@ public ApiResponseMap validate(Map arg, SchemaConfiguration conf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java index 59300b881f0..62ee964cd3e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java @@ -48,16 +48,6 @@ public static Cultivar getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -65,8 +55,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -100,16 +90,6 @@ public static Origin getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -117,8 +97,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -165,7 +145,7 @@ public static class AppleMapInput { } - public static class Apple1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator { + public static class Apple1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -178,7 +158,7 @@ protected Apple1() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) .properties(Map.ofEntries( new PropertyEntry("cultivar", Cultivar.class), @@ -197,16 +177,6 @@ public static Apple1 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -214,29 +184,14 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - public AppleMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AppleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -252,7 +207,7 @@ public AppleMap getNewInstance(FrozenMap arg, List pathToItem, P public AppleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -264,9 +219,8 @@ public AppleMap validate(Map arg, SchemaConfiguration configurat public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java index a5cf54a4691..b93b623a042 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.schemas.BooleanJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -67,7 +66,7 @@ public static class AppleReqMapInput { } - public static class AppleReq1 extends JsonSchema implements MapSchemaValidator { + public static class AppleReq1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -78,7 +77,7 @@ public static class AppleReq1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AppleReqMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AppleReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -131,7 +115,7 @@ public AppleReqMap getNewInstance(FrozenMap arg, List pathToItem public AppleReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -141,9 +125,8 @@ public AppleReqMap validate(Map arg, SchemaConfiguration configu @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java index 381864eceed..976849c415e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java @@ -40,7 +40,7 @@ public static class ArrayHoldingAnyTypeListInput { } - public static class ArrayHoldingAnyType1 extends JsonSchema implements ListSchemaValidator { + public static class ArrayHoldingAnyType1 extends JsonSchema implements ListSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -51,7 +51,7 @@ public static class ArrayHoldingAnyType1 extends JsonSchema implements ListSchem protected ArrayHoldingAnyType1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -64,29 +64,14 @@ public static ArrayHoldingAnyType1 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = (Object) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayHoldingAnyTypeList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -98,7 +83,7 @@ public ArrayHoldingAnyTypeList getNewInstance(FrozenList arg, List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -107,9 +92,8 @@ public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration co @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index 673cad73b8d..e4b55c2a282 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -43,12 +43,12 @@ public static class ItemsListInput { } - public static class Items extends JsonSchema implements ListSchemaValidator { + public static class Items extends JsonSchema implements ListSchemaValidator { private static Items instance; protected Items() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items1.class) ); } @@ -61,29 +61,14 @@ public static Items getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Number item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Number fixedVal = (Number) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (Number item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Number castItem = (Number) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Number castItem = (Number) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -95,7 +80,7 @@ public ItemsList getNewInstance(FrozenList arg, List pathToItem, public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -104,9 +89,8 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) t @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -126,12 +110,12 @@ public static class ArrayArrayNumberListInput { } - public static class ArrayArrayNumber extends JsonSchema implements ListSchemaValidator, FrozenList, ArrayArrayNumberList> { + public static class ArrayArrayNumber extends JsonSchema implements ListSchemaValidator, ArrayArrayNumberList> { private static ArrayArrayNumber instance; protected ArrayArrayNumber() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -144,29 +128,14 @@ public static ArrayArrayNumber getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (List item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenList fixedVal = (FrozenList) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayArrayNumberList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenList item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - ItemsList castItem = (ItemsList) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + ItemsList castItem = (ItemsList) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -178,7 +147,7 @@ public ArrayArrayNumberList getNewInstance(FrozenList> arg, L public ArrayArrayNumberList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -187,9 +156,8 @@ public ArrayArrayNumberList validate(List> arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -224,7 +192,7 @@ public static class ArrayOfArrayOfNumberOnlyMapInput { } - public static class ArrayOfArrayOfNumberOnly1 extends JsonSchema implements MapSchemaValidator { + public static class ArrayOfArrayOfNumberOnly1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -235,7 +203,7 @@ public static class ArrayOfArrayOfNumberOnly1 extends JsonSchema implements MapS protected ArrayOfArrayOfNumberOnly1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("ArrayArrayNumber", ArrayArrayNumber.class) )) @@ -249,25 +217,10 @@ public static ArrayOfArrayOfNumberOnly1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ArrayOfArrayOfNumberOnlyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -283,7 +236,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -293,9 +246,8 @@ public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java index 491a0ba761b..77e4518acd3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java @@ -36,7 +36,7 @@ public static class ArrayOfEnumsListInput { } - public static class ArrayOfEnums1 extends JsonSchema implements ListSchemaValidator { + public static class ArrayOfEnums1 extends JsonSchema implements ListSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -47,7 +47,7 @@ public static class ArrayOfEnums1 extends JsonSchema implements ListSchemaValida protected ArrayOfEnums1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(StringEnum.StringEnum1.class) ); } @@ -60,29 +60,14 @@ public static ArrayOfEnums1 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayOfEnumsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -94,7 +79,7 @@ public ArrayOfEnumsList getNewInstance(FrozenList arg, List path public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -103,9 +88,8 @@ public ArrayOfEnumsList validate(List arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index fda7fb8c4e4..7b9a8697601 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -43,12 +43,12 @@ public static class ArrayNumberListInput { } - public static class ArrayNumber extends JsonSchema implements ListSchemaValidator { + public static class ArrayNumber extends JsonSchema implements ListSchemaValidator { private static ArrayNumber instance; protected ArrayNumber() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -61,29 +61,14 @@ public static ArrayNumber getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Number item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Number fixedVal = (Number) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayNumberList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (Number item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Number castItem = (Number) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Number castItem = (Number) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -95,7 +80,7 @@ public ArrayNumberList getNewInstance(FrozenList arg, List pathT public ArrayNumberList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -104,9 +89,8 @@ public ArrayNumberList validate(List arg, SchemaConfiguration configurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -141,7 +125,7 @@ public static class ArrayOfNumberOnlyMapInput { } - public static class ArrayOfNumberOnly1 extends JsonSchema implements MapSchemaValidator { + public static class ArrayOfNumberOnly1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -152,7 +136,7 @@ public static class ArrayOfNumberOnly1 extends JsonSchema implements MapSchemaVa protected ArrayOfNumberOnly1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("ArrayNumber", ArrayNumber.class) )) @@ -166,25 +150,10 @@ public static ArrayOfNumberOnly1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ArrayOfNumberOnlyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -200,7 +169,7 @@ public ArrayOfNumberOnlyMap getNewInstance(FrozenMap arg, List p public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -210,9 +179,8 @@ public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index d0e70db0ea7..5dace3ca158 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -44,12 +44,12 @@ public static class ArrayOfStringListInput { } - public static class ArrayOfString extends JsonSchema implements ListSchemaValidator { + public static class ArrayOfString extends JsonSchema implements ListSchemaValidator { private static ArrayOfString instance; protected ArrayOfString() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -62,29 +62,14 @@ public static ArrayOfString getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayOfStringList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayOfStringList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -96,7 +81,7 @@ public ArrayOfStringList getNewInstance(FrozenList arg, List pat public ArrayOfStringList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -105,9 +90,8 @@ public ArrayOfStringList validate(List arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -130,12 +114,12 @@ public static class ItemsListInput { } - public static class Items1 extends JsonSchema implements ListSchemaValidator { + public static class Items1 extends JsonSchema implements ListSchemaValidator { private static Items1 instance; protected Items1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items2.class) ); } @@ -148,29 +132,14 @@ public static Items1 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Long item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Long fixedVal = (Long) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (Long item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Long castItem = (Long) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Long castItem = (Long) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -182,7 +151,7 @@ public ItemsList getNewInstance(FrozenList arg, List pathToItem, P public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -191,9 +160,8 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) thr @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -213,12 +181,12 @@ public static class ArrayArrayOfIntegerListInput { } - public static class ArrayArrayOfInteger extends JsonSchema implements ListSchemaValidator, FrozenList, ArrayArrayOfIntegerList> { + public static class ArrayArrayOfInteger extends JsonSchema implements ListSchemaValidator, ArrayArrayOfIntegerList> { private static ArrayArrayOfInteger instance; protected ArrayArrayOfInteger() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items1.class) ); } @@ -231,29 +199,14 @@ public static ArrayArrayOfInteger getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (List item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenList fixedVal = (FrozenList) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayArrayOfIntegerList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenList item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - ItemsList castItem = (ItemsList) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + ItemsList castItem = (ItemsList) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -265,7 +218,7 @@ public ArrayArrayOfIntegerList getNewInstance(FrozenList> arg, public ArrayArrayOfIntegerList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -274,9 +227,8 @@ public ArrayArrayOfIntegerList validate(List> arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -296,12 +248,12 @@ public static class ItemsListInput1 { } - public static class Items3 extends JsonSchema implements ListSchemaValidator, FrozenMap, ItemsList1> { + public static class Items3 extends JsonSchema implements ListSchemaValidator, ItemsList1> { private static Items3 instance; protected Items3() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(ReadOnlyFirst.ReadOnlyFirst1.class) ); } @@ -314,29 +266,14 @@ public static Items3 getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ItemsList1 getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - ReadOnlyFirst.ReadOnlyFirstMap castItem = (ReadOnlyFirst.ReadOnlyFirstMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + ReadOnlyFirst.ReadOnlyFirstMap castItem = (ReadOnlyFirst.ReadOnlyFirstMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -348,7 +285,7 @@ public ItemsList1 getNewInstance(FrozenList> arg, List public ItemsList1 validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -357,9 +294,8 @@ public ItemsList1 validate(List> arg, SchemaConfiguration co @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -379,12 +315,12 @@ public static class ArrayArrayOfModelListInput { } - public static class ArrayArrayOfModel extends JsonSchema implements ListSchemaValidator>, FrozenList>, ArrayArrayOfModelList> { + public static class ArrayArrayOfModel extends JsonSchema implements ListSchemaValidator>, ArrayArrayOfModelList> { private static ArrayArrayOfModel instance; protected ArrayArrayOfModel() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items3.class) ); } @@ -397,29 +333,14 @@ public static ArrayArrayOfModel getInstance() { } @Override - public FrozenList>> castToAllowedTypes(List>> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List>> argFixed = new ArrayList<>(); - int i =0; - for (List> item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenList> fixedVal = (FrozenList>) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayArrayOfModelList getNewInstance(FrozenList>> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenList> item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - ItemsList1 castItem = (ItemsList1) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + ItemsList1 castItem = (ItemsList1) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -431,7 +352,7 @@ public ArrayArrayOfModelList getNewInstance(FrozenList>> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList>> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -440,9 +361,8 @@ public ArrayArrayOfModelList validate(List>> arg, Schem @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList>> castArg = (FrozenList>>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -491,7 +411,7 @@ public static class ArrayTestMapInput { } - public static class ArrayTest1 extends JsonSchema implements MapSchemaValidator { + public static class ArrayTest1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -502,7 +422,7 @@ public static class ArrayTest1 extends JsonSchema implements MapSchemaValidator< protected ArrayTest1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("array_of_string", ArrayOfString.class), new PropertyEntry("array_array_of_integer", ArrayArrayOfInteger.class), @@ -518,25 +438,10 @@ public static ArrayTest1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ArrayTestMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -552,7 +457,7 @@ public ArrayTestMap getNewInstance(FrozenMap arg, List pathToIte public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -562,9 +467,8 @@ public ArrayTestMap validate(Map arg, SchemaConfiguration config @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java index 212474825e1..627f8d09ef4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java @@ -46,16 +46,6 @@ public static Items getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,8 +53,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -106,7 +96,7 @@ public static class ArrayWithValidationsInItemsListInput { } - public static class ArrayWithValidationsInItems1 extends JsonSchema implements ListSchemaValidator { + public static class ArrayWithValidationsInItems1 extends JsonSchema implements ListSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -117,7 +107,7 @@ public static class ArrayWithValidationsInItems1 extends JsonSchema implements L protected ArrayWithValidationsInItems1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) .maxItems(2) ); @@ -131,29 +121,14 @@ public static ArrayWithValidationsInItems1 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Long item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Long fixedVal = (Long) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayWithValidationsInItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayWithValidationsInItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (Long item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Long castItem = (Long) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Long castItem = (Long) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -165,7 +140,7 @@ public ArrayWithValidationsInItemsList getNewInstance(FrozenList arg, List public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -174,9 +149,8 @@ public ArrayWithValidationsInItemsList validate(List arg, SchemaConfigurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java index f6de4de80d8..dcb75d61a79 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java @@ -54,7 +54,7 @@ public static class BananaMapInput { } - public static class Banana1 extends JsonSchema implements MapSchemaValidator { + public static class Banana1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -65,7 +65,7 @@ public static class Banana1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public BananaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public BananaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -116,7 +101,7 @@ public BananaMap getNewInstance(FrozenMap arg, List pathToItem, public BananaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -126,9 +111,8 @@ public BananaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java index b1db43a1cd2..3c0a392253e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.schemas.BooleanJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NumberJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -67,7 +66,7 @@ public static class BananaReqMapInput { } - public static class BananaReq1 extends JsonSchema implements MapSchemaValidator { + public static class BananaReq1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -78,7 +77,7 @@ public static class BananaReq1 extends JsonSchema implements MapSchemaValidator< protected BananaReq1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("lengthCm", LengthCm.class), new PropertyEntry("sweet", Sweet.class) @@ -97,25 +96,10 @@ public static BananaReq1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public BananaReqMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public BananaReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -131,7 +115,7 @@ public BananaReqMap getNewInstance(FrozenMap arg, List pathToIte public BananaReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -141,9 +125,8 @@ public BananaReqMap validate(Map arg, SchemaConfiguration config @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java index 4a12102e5f5..8c4c314b54d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java @@ -45,16 +45,6 @@ public static Bar1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -62,8 +52,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java index 45dc417a8dc..19b6e49974c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java @@ -46,16 +46,6 @@ public static ClassName getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,8 +53,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -103,7 +93,7 @@ public static class BasquePigMapInput { } - public static class BasquePig1 extends JsonSchema implements MapSchemaValidator { + public static class BasquePig1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -114,7 +104,7 @@ public static class BasquePig1 extends JsonSchema implements MapSchemaValidator< protected BasquePig1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("className", ClassName.class) )) @@ -131,25 +121,10 @@ public static BasquePig1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public BasquePigMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public BasquePigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -165,7 +140,7 @@ public BasquePigMap getNewInstance(FrozenMap arg, List pathToIte public BasquePigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -175,9 +150,8 @@ public BasquePigMap validate(Map arg, SchemaConfiguration config @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java index dc2fab51977..c73efcf8c26 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java @@ -47,16 +47,6 @@ public static BooleanEnum1 getInstance() { return instance; } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -64,8 +54,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java index 69b7e89bb62..0870e795ba8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java @@ -106,7 +106,7 @@ public static class CapitalizationMapInput { } - public static class Capitalization1 extends JsonSchema implements MapSchemaValidator { + public static class Capitalization1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -117,7 +117,7 @@ public static class Capitalization1 extends JsonSchema implements MapSchemaValid protected Capitalization1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("smallCamel", SmallCamel.class), new PropertyEntry("CapitalCamel", CapitalCamel.class), @@ -136,25 +136,10 @@ public static Capitalization1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public CapitalizationMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public CapitalizationMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -170,7 +155,7 @@ public CapitalizationMap getNewInstance(FrozenMap arg, List path public CapitalizationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -180,9 +165,8 @@ public CapitalizationMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java index 123d95d4fce..175963bce97 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java @@ -65,12 +65,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("declawed", Declawed.class) )) @@ -84,25 +84,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -118,7 +103,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -128,16 +113,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Cat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Cat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -161,15 +145,6 @@ public static Cat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -180,18 +155,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -203,18 +168,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -226,8 +181,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -246,16 +201,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -265,8 +210,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -282,46 +227,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -329,7 +274,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -348,12 +293,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java index 56410357aa8..97b8dbf4e7a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java @@ -46,16 +46,6 @@ public static Name getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,8 +53,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -111,7 +101,7 @@ public static class CategoryMapInput { } - public static class Category1 extends JsonSchema implements MapSchemaValidator { + public static class Category1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -122,7 +112,7 @@ public static class Category1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public CategoryMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public CategoryMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -174,7 +149,7 @@ public CategoryMap getNewInstance(FrozenMap arg, List pathToItem public CategoryMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -184,9 +159,8 @@ public CategoryMap validate(Map arg, SchemaConfiguration configu @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java index 32b88c65170..3f37718ce9d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java @@ -65,12 +65,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("name", Name.class) )) @@ -84,25 +84,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -118,7 +103,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -128,16 +113,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class ChildCat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ChildCat1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -161,15 +145,6 @@ public static ChildCat1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -180,18 +155,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -203,18 +168,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -226,8 +181,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -246,16 +201,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -265,8 +210,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -282,46 +227,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -329,7 +274,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -348,12 +293,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java index 33762434042..eb091240175 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java @@ -59,7 +59,7 @@ public static class ClassModelMapInput { } - public static class ClassModel1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class ClassModel1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -84,15 +84,6 @@ public static ClassModel1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -103,18 +94,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -126,18 +107,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -149,8 +120,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -169,16 +140,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -188,8 +149,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -205,53 +166,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public ClassModelMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ClassModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -263,7 +213,7 @@ public ClassModelMap validate(Map arg, SchemaConfiguration confi Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -282,12 +232,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java index 0aab763dfa5..75ce39f87aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java @@ -56,7 +56,7 @@ public static class ClientMapInput { } - public static class Client1 extends JsonSchema implements MapSchemaValidator { + public static class Client1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -67,7 +67,7 @@ public static class Client1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ClientMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ClientMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -115,7 +100,7 @@ public ClientMap getNewInstance(FrozenMap arg, List pathToItem, public ClientMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -125,9 +110,8 @@ public ClientMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java index b06de88b9ab..00f4a80d1a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java @@ -54,16 +54,6 @@ public static QuadrilateralType getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -71,8 +61,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -113,12 +103,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("quadrilateralType", QuadrilateralType.class) )) @@ -132,25 +122,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -166,7 +141,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -176,16 +151,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class ComplexQuadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ComplexQuadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -209,15 +183,6 @@ public static ComplexQuadrilateral1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -228,18 +193,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -251,18 +206,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -274,8 +219,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -294,16 +239,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -313,8 +248,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -330,46 +265,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -377,7 +312,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -396,12 +331,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java index 618cf9f6681..7b88d3f4189 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java @@ -90,12 +90,12 @@ public static class Schema9ListInput { } - public static class Schema9 extends JsonSchema implements ListSchemaValidator { + public static class Schema9 extends JsonSchema implements ListSchemaValidator { private static Schema9 instance; protected Schema9() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -108,29 +108,14 @@ public static Schema9 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = (Object) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public Schema9List getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public Schema9List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -142,7 +127,7 @@ public Schema9List getNewInstance(FrozenList arg, List pathToIte public Schema9List validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -151,9 +136,8 @@ public Schema9List validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -177,7 +161,7 @@ public static class Schema14 extends Int32JsonSchema {} public static class Schema15 extends Int64JsonSchema {} - public static class ComposedAnyOfDifferentTypesNoValidations1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ComposedAnyOfDifferentTypesNoValidations1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -215,15 +199,6 @@ public static ComposedAnyOfDifferentTypesNoValidations1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -234,18 +209,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -257,18 +222,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -280,8 +235,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -300,16 +255,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -319,8 +264,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -336,46 +281,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -383,7 +328,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -402,12 +347,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java index c476883c6b3..d008039df45 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java @@ -40,7 +40,7 @@ public static class ComposedArrayListInput { } - public static class ComposedArray1 extends JsonSchema implements ListSchemaValidator { + public static class ComposedArray1 extends JsonSchema implements ListSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -51,7 +51,7 @@ public static class ComposedArray1 extends JsonSchema implements ListSchemaValid protected ComposedArray1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -64,29 +64,14 @@ public static ComposedArray1 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = (Object) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ComposedArrayList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ComposedArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -98,7 +83,7 @@ public ComposedArrayList getNewInstance(FrozenList arg, List pat public ComposedArrayList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -107,9 +92,8 @@ public ComposedArrayList validate(List arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java index 30955318d9e..bb93ab28500 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java @@ -50,16 +50,6 @@ public static ComposedBool1 getInstance() { return instance; } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,8 +57,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java index b536d07c714..ec201c296d1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java @@ -50,16 +50,6 @@ public static ComposedNone1 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,8 +57,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java index f9b7ddf255a..d6d720eacf9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java @@ -55,16 +55,6 @@ public static ComposedNumber1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -73,7 +63,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java index dc69fa9030e..961ca919065 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java @@ -26,7 +26,7 @@ public class ComposedObject { public static class Schema0 extends AnyTypeJsonSchema {} - public static class ComposedObject1 extends JsonSchema implements MapSchemaValidator> { + public static class ComposedObject1 extends JsonSchema implements MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -37,7 +37,7 @@ public static class ComposedObject1 extends JsonSchema implements MapSchemaValid protected ComposedObject1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .allOf(List.of( Schema0.class )) @@ -51,31 +51,26 @@ public static ComposedObject1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -85,9 +80,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java index f2791ea5279..11ed674b303 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java @@ -41,12 +41,12 @@ public static class Schema2 extends NullJsonSchema {} public static class Schema3 extends DateJsonSchema {} - public static class Schema4 extends JsonSchema implements MapSchemaValidator> { + public static class Schema4 extends JsonSchema implements MapSchemaValidator> { private static Schema4 instance; protected Schema4() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .maxProperties(4) .minProperties(4) ); @@ -59,31 +59,26 @@ public static Schema4 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -93,9 +88,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -119,12 +113,12 @@ public static class Schema5ListInput { } - public static class Schema5 extends JsonSchema implements ListSchemaValidator { + public static class Schema5 extends JsonSchema implements ListSchemaValidator { private static Schema5 instance; protected Schema5() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) .maxItems(4) .minItems(4) @@ -139,29 +133,14 @@ public static Schema5 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = (Object) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public Schema5List getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public Schema5List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -173,7 +152,7 @@ public Schema5List getNewInstance(FrozenList arg, List pathToIte public Schema5List validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -182,9 +161,8 @@ public Schema5List validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -212,16 +190,6 @@ public static Schema6 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -229,8 +197,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -242,7 +210,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class ComposedOneOfDifferentTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ComposedOneOfDifferentTypes1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -273,15 +241,6 @@ public static ComposedOneOfDifferentTypes1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -292,18 +251,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -315,18 +264,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -338,8 +277,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -358,16 +297,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -377,8 +306,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -394,46 +323,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -441,7 +370,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -460,12 +389,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java index 65604a85801..f7f6c58fac2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java @@ -52,16 +52,6 @@ public static ComposedString1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -69,8 +59,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java index 9aaf129b1fc..b29912b549d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java @@ -50,16 +50,6 @@ public static Currency1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,8 +57,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java index 123ae7256dd..e356aa2f46e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java @@ -46,16 +46,6 @@ public static ClassName getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,8 +53,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -103,7 +93,7 @@ public static class DanishPigMapInput { } - public static class DanishPig1 extends JsonSchema implements MapSchemaValidator { + public static class DanishPig1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -114,7 +104,7 @@ public static class DanishPig1 extends JsonSchema implements MapSchemaValidator< protected DanishPig1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("className", ClassName.class) )) @@ -131,25 +121,10 @@ public static DanishPig1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public DanishPigMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public DanishPigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -165,7 +140,7 @@ public DanishPigMap getNewInstance(FrozenMap arg, List pathToIte public DanishPigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -175,9 +150,8 @@ public DanishPigMap validate(Map arg, SchemaConfiguration config @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java index 69c8799eaa8..5e3aa43478b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java @@ -47,16 +47,6 @@ public static DateTimeTest1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -64,8 +54,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java index b1b4627eb94..8f14ef82304 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java @@ -51,16 +51,6 @@ public static DateTimeWithValidations1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,8 +58,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java index e72de43f330..221ae066f90 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java @@ -51,16 +51,6 @@ public static DateWithValidations1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,8 +58,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java index 9c6cd1ee7db..d75c4e1b932 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java @@ -65,12 +65,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("breed", Breed.class) )) @@ -84,25 +84,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -118,7 +103,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -128,16 +113,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Dog1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Dog1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -161,15 +145,6 @@ public static Dog1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -180,18 +155,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -203,18 +168,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -226,8 +181,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -246,16 +201,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -265,8 +210,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -282,46 +227,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -329,7 +274,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -348,12 +293,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index c9a9f8e7847..b180bb3dbe4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -40,12 +39,12 @@ public static class ShapesListInput { } - public static class Shapes extends JsonSchema implements ListSchemaValidator { + public static class Shapes extends JsonSchema implements ListSchemaValidator { private static Shapes instance; protected Shapes() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Shape.Shape1.class) ); } @@ -58,29 +57,14 @@ public static Shapes getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = (Object) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ShapesList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ShapesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -92,7 +76,7 @@ public ShapesList getNewInstance(FrozenList arg, List pathToItem public ShapesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -101,9 +85,8 @@ public ShapesList validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -158,7 +141,7 @@ public static class DrawingMapInput { } - public static class Drawing1 extends JsonSchema implements MapSchemaValidator { + public static class Drawing1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -169,7 +152,7 @@ public static class Drawing1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public DrawingMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public DrawingMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -221,7 +189,7 @@ public DrawingMap getNewInstance(FrozenMap arg, List pathToItem, public DrawingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -231,9 +199,8 @@ public DrawingMap validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index f2bbf0da1a7..91744842bad 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -49,16 +49,6 @@ public static JustSymbol getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -66,8 +56,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -101,16 +91,6 @@ public static Items getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -118,8 +98,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -145,12 +125,12 @@ public static class ArrayEnumListInput { } - public static class ArrayEnum extends JsonSchema implements ListSchemaValidator { + public static class ArrayEnum extends JsonSchema implements ListSchemaValidator { private static ArrayEnum instance; protected ArrayEnum() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -163,29 +143,14 @@ public static ArrayEnum getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayEnumList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayEnumList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -197,7 +162,7 @@ public ArrayEnumList getNewInstance(FrozenList arg, List pathToI public ArrayEnumList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -206,9 +171,8 @@ public ArrayEnumList validate(List arg, SchemaConfiguration configuratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -250,7 +214,7 @@ public static class EnumArraysMapInput { } - public static class EnumArrays1 extends JsonSchema implements MapSchemaValidator { + public static class EnumArrays1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -261,7 +225,7 @@ public static class EnumArrays1 extends JsonSchema implements MapSchemaValidator protected EnumArrays1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("just_symbol", JustSymbol.class), new PropertyEntry("array_enum", ArrayEnum.class) @@ -276,25 +240,10 @@ public static EnumArrays1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public EnumArraysMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public EnumArraysMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -310,7 +259,7 @@ public EnumArraysMap getNewInstance(FrozenMap arg, List pathToIt public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -320,9 +269,8 @@ public EnumArraysMap validate(Map arg, SchemaConfiguration confi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java index bd42789c1df..dc394c067b8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java @@ -53,16 +53,6 @@ public static EnumClass1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -70,8 +60,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java index 68fbb9c9c29..6457d9367c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java @@ -49,16 +49,6 @@ public static EnumString getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -66,8 +56,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -102,16 +92,6 @@ public static EnumStringRequired getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -119,8 +99,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -158,16 +138,6 @@ public static EnumInteger getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -175,8 +145,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -222,16 +192,6 @@ public static EnumNumber getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -240,7 +200,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); @@ -339,7 +299,7 @@ public static class EnumTestMapInput { } - public static class EnumTest1 extends JsonSchema implements MapSchemaValidator { + public static class EnumTest1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -350,7 +310,7 @@ public static class EnumTest1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public EnumTestMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public EnumTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -409,7 +354,7 @@ public EnumTestMap getNewInstance(FrozenMap arg, List pathToItem public EnumTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -419,9 +364,8 @@ public EnumTestMap validate(Map arg, SchemaConfiguration configu @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java index 1f801080c34..b9c9d52bdeb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java @@ -54,16 +54,6 @@ public static TriangleType getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -71,8 +61,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -113,12 +103,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("triangleType", TriangleType.class) )) @@ -132,25 +122,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -166,7 +141,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -176,16 +151,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class EquilateralTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class EquilateralTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -209,15 +183,6 @@ public static EquilateralTriangle1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -228,18 +193,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -251,18 +206,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -274,8 +219,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -294,16 +239,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -313,8 +248,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -330,46 +265,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -377,7 +312,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -396,12 +331,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java index 384f6236760..254e4823b5a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java @@ -56,7 +56,7 @@ public static class FileMapInput { } - public static class File1 extends JsonSchema implements MapSchemaValidator { + public static class File1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -69,7 +69,7 @@ public static class File1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public FileMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FileMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -117,7 +102,7 @@ public FileMap getNewInstance(FrozenMap arg, List pathToItem, Pa public FileMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -127,9 +112,8 @@ public FileMap validate(Map arg, SchemaConfiguration configurati @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index 9d6228766d2..c9d8cc138b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -39,12 +39,12 @@ public static class FilesListInput { } - public static class Files extends JsonSchema implements ListSchemaValidator, FrozenMap, FilesList> { + public static class Files extends JsonSchema implements ListSchemaValidator, FilesList> { private static Files instance; protected Files() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(File.File1.class) ); } @@ -57,29 +57,14 @@ public static Files getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public FilesList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public FilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - File.FileMap castItem = (File.FileMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + File.FileMap castItem = (File.FileMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -91,7 +76,7 @@ public FilesList getNewInstance(FrozenList> arg, List public FilesList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -100,9 +85,8 @@ public FilesList validate(List> arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -144,7 +128,7 @@ public static class FileSchemaTestClassMapInput { } - public static class FileSchemaTestClass1 extends JsonSchema implements MapSchemaValidator { + public static class FileSchemaTestClass1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -155,7 +139,7 @@ public static class FileSchemaTestClass1 extends JsonSchema implements MapSchema protected FileSchemaTestClass1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("file", File.File1.class), new PropertyEntry("files", Files.class) @@ -170,25 +154,10 @@ public static FileSchemaTestClass1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public FileSchemaTestClassMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FileSchemaTestClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -204,7 +173,7 @@ public FileSchemaTestClassMap getNewInstance(FrozenMap arg, List public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -214,9 +183,8 @@ public FileSchemaTestClassMap validate(Map arg, SchemaConfigurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java index 57ca3487008..eb59c8aa1ba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java @@ -52,7 +52,7 @@ public static class FooMapInput { } - public static class Foo1 extends JsonSchema implements MapSchemaValidator { + public static class Foo1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -63,7 +63,7 @@ public static class Foo1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public FooMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FooMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -111,7 +96,7 @@ public FooMap getNewInstance(FrozenMap arg, List pathToItem, Pat public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -121,9 +106,8 @@ public FooMap validate(Map arg, SchemaConfiguration configuratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index e8ed6e0e59e..206208a29bd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -63,16 +63,6 @@ public static IntegerSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -80,8 +70,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -136,16 +126,6 @@ public static Int32withValidations getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -153,8 +133,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -201,16 +181,6 @@ public static NumberSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -219,7 +189,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); @@ -270,16 +240,6 @@ public static FloatSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -288,7 +248,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); @@ -330,16 +290,6 @@ public static DoubleSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -348,7 +298,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); @@ -383,12 +333,12 @@ public static class ArrayWithUniqueItemsListInput { } - public static class ArrayWithUniqueItems extends JsonSchema implements ListSchemaValidator { + public static class ArrayWithUniqueItems extends JsonSchema implements ListSchemaValidator { private static ArrayWithUniqueItems instance; protected ArrayWithUniqueItems() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) .uniqueItems(true) ); @@ -402,29 +352,14 @@ public static ArrayWithUniqueItems getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Number item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Number fixedVal = (Number) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayWithUniqueItemsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (Number item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Number castItem = (Number) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Number castItem = (Number) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -436,7 +371,7 @@ public ArrayWithUniqueItemsList getNewInstance(FrozenList arg, List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -445,9 +380,8 @@ public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -475,16 +409,6 @@ public static StringSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -492,8 +416,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -546,16 +470,6 @@ public static Password getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -563,8 +477,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -597,16 +511,6 @@ public static PatternWithDigits getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -614,8 +518,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -649,16 +553,6 @@ public static PatternWithDigitsAndDelimiter getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -666,8 +560,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -806,7 +700,7 @@ public static class FormatTestMapInput { } - public static class FormatTest1 extends JsonSchema implements MapSchemaValidator { + public static class FormatTest1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -817,7 +711,7 @@ public static class FormatTest1 extends JsonSchema implements MapSchemaValidator protected FormatTest1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("integer", IntegerSchema.class), new PropertyEntry("int32", Int32.class), @@ -857,25 +751,10 @@ public static FormatTest1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public FormatTestMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FormatTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -891,7 +770,7 @@ public FormatTestMap getNewInstance(FrozenMap arg, List pathToIt public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -901,9 +780,8 @@ public FormatTestMap validate(Map arg, SchemaConfiguration confi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java index c3a0c80ffa4..0bb941cd4e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java @@ -67,7 +67,7 @@ public static class FromSchemaMapInput { } - public static class FromSchema1 extends JsonSchema implements MapSchemaValidator { + public static class FromSchema1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -78,7 +78,7 @@ public static class FromSchema1 extends JsonSchema implements MapSchemaValidator protected FromSchema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("data", Data.class), new PropertyEntry("id", Id.class) @@ -93,25 +93,10 @@ public static FromSchema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public FromSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FromSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -127,7 +112,7 @@ public FromSchemaMap getNewInstance(FrozenMap arg, List pathToIt public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -137,9 +122,8 @@ public FromSchemaMap validate(Map arg, SchemaConfiguration confi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java index 5d9553b9b7f..30e4a1f4461 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java @@ -65,7 +65,7 @@ public static class FruitMapInput { } - public static class Fruit1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Fruit1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -92,15 +92,6 @@ public static Fruit1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -111,18 +102,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -134,18 +115,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -157,8 +128,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -177,16 +148,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -196,8 +157,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -213,53 +174,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public FruitMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -271,7 +221,7 @@ public FruitMap validate(Map arg, SchemaConfiguration configurat Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -290,12 +240,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java index 1973c20dfad..ce70656b631 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java @@ -35,7 +35,7 @@ public class FruitReq { public static class Schema0 extends NullJsonSchema {} - public static class FruitReq1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class FruitReq1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -60,15 +60,6 @@ public static FruitReq1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -79,18 +70,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -102,18 +83,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -125,8 +96,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -145,16 +116,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -164,8 +125,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -181,46 +142,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -228,7 +189,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -247,12 +208,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java index cacbe9c244b..36fefe1ea04 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java @@ -65,7 +65,7 @@ public static class GmFruitMapInput { } - public static class GmFruit1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class GmFruit1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -92,15 +92,6 @@ public static GmFruit1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -111,18 +102,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -134,18 +115,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -157,8 +128,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -177,16 +148,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -196,8 +157,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -213,53 +174,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public GmFruitMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -271,7 +221,7 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configur Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -290,12 +240,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java index 20110aa346a..f48fde7ed63 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java @@ -54,7 +54,7 @@ public static class GrandparentAnimalMapInput { } - public static class GrandparentAnimal1 extends JsonSchema implements MapSchemaValidator { + public static class GrandparentAnimal1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -65,7 +65,7 @@ public static class GrandparentAnimal1 extends JsonSchema implements MapSchemaVa protected GrandparentAnimal1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("pet_type", PetType.class) )) @@ -82,25 +82,10 @@ public static GrandparentAnimal1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public GrandparentAnimalMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public GrandparentAnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -116,7 +101,7 @@ public GrandparentAnimalMap getNewInstance(FrozenMap arg, List p public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -126,9 +111,8 @@ public GrandparentAnimalMap validate(Map arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java index 39621a84437..59161310658 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java @@ -66,7 +66,7 @@ public static class HasOnlyReadOnlyMapInput { } - public static class HasOnlyReadOnly1 extends JsonSchema implements MapSchemaValidator { + public static class HasOnlyReadOnly1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -77,7 +77,7 @@ public static class HasOnlyReadOnly1 extends JsonSchema implements MapSchemaVali protected HasOnlyReadOnly1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("bar", Bar.class), new PropertyEntry("foo", Foo.class) @@ -92,25 +92,10 @@ public static HasOnlyReadOnly1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HasOnlyReadOnlyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -126,7 +111,7 @@ public HasOnlyReadOnlyMap getNewInstance(FrozenMap arg, List pat public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -136,9 +121,8 @@ public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java index 15f7a48f922..ad47788f429 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java @@ -45,16 +45,6 @@ public static NullableMessage getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -62,18 +52,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -83,8 +63,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -127,7 +107,7 @@ public static class HealthCheckResultMapInput { } - public static class HealthCheckResult1 extends JsonSchema implements MapSchemaValidator { + public static class HealthCheckResult1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -140,7 +120,7 @@ public static class HealthCheckResult1 extends JsonSchema implements MapSchemaVa protected HealthCheckResult1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("NullableMessage", NullableMessage.class) )) @@ -154,25 +134,10 @@ public static HealthCheckResult1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HealthCheckResultMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HealthCheckResultMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -188,7 +153,7 @@ public HealthCheckResultMap getNewInstance(FrozenMap arg, List p public HealthCheckResultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -198,9 +163,8 @@ public HealthCheckResultMap validate(Map arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java index 39f41041782..d4d42fca765 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java @@ -54,16 +54,6 @@ public static IntegerEnum1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -71,8 +61,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java index 18462d98f5b..7880d2e227c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java @@ -54,16 +54,6 @@ public static IntegerEnumBig1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -71,8 +61,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java index b3bac3539b0..e2702ccdcbe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java @@ -52,16 +52,6 @@ public static IntegerEnumOneValue1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -69,8 +59,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java index 69e38276b8e..1149b8c7a9f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java @@ -54,16 +54,6 @@ public static IntegerEnumWithDefaultValue1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -71,8 +61,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java index 957befac66a..01bb9f0ed76 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java @@ -50,16 +50,6 @@ public static IntegerMax101 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,8 +57,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java index 5dee20c747d..44134b3d182 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java @@ -50,16 +50,6 @@ public static IntegerMin151 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,8 +57,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java index 25d6ca097b9..58d2e149001 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java @@ -54,16 +54,6 @@ public static TriangleType getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -71,8 +61,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -113,12 +103,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("triangleType", TriangleType.class) )) @@ -132,25 +122,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -166,7 +141,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -176,16 +151,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class IsoscelesTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class IsoscelesTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -209,15 +183,6 @@ public static IsoscelesTriangle1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -228,18 +193,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -251,18 +206,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -274,8 +219,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -294,16 +239,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -313,8 +248,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -330,46 +265,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -377,7 +312,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -396,12 +331,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java index 66fc1c867d8..7a620aa049a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java @@ -41,7 +41,7 @@ public static class ItemsListInput { } - public static class Items1 extends JsonSchema implements ListSchemaValidator, FrozenMap, ItemsList> { + public static class Items1 extends JsonSchema implements ListSchemaValidator, ItemsList> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -54,7 +54,7 @@ public static class Items1 extends JsonSchema implements ListSchemaValidator> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ItemsList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList> items = new ArrayList<>(); + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List> items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - FrozenMap castItem = (FrozenMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + FrozenMap castItem = (FrozenMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -101,7 +86,7 @@ public ItemsList getNewInstance(FrozenList> arg, List public ItemsList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -110,9 +95,8 @@ public ItemsList validate(List> arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java index 3c456e9ec1f..e8991b97a6e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java @@ -31,7 +31,7 @@ public class JSONPatchRequest { // nest classes so all schemas and input/output classes can be public - public static class Items extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Items extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Items instance; protected Items() { @@ -50,15 +50,6 @@ public static Items getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -69,18 +60,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -92,18 +73,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -115,8 +86,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -135,16 +106,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -154,8 +115,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -171,46 +132,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -218,7 +179,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -237,12 +198,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -262,7 +221,7 @@ public static class JSONPatchRequestListInput { } - public static class JSONPatchRequest1 extends JsonSchema implements ListSchemaValidator { + public static class JSONPatchRequest1 extends JsonSchema implements ListSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -273,7 +232,7 @@ public static class JSONPatchRequest1 extends JsonSchema implements ListSchemaVa protected JSONPatchRequest1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -286,29 +245,14 @@ public static JSONPatchRequest1 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = (Object) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public JSONPatchRequestList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public JSONPatchRequestList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -320,7 +264,7 @@ public JSONPatchRequestList getNewInstance(FrozenList arg, List public JSONPatchRequestList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -329,9 +273,8 @@ public JSONPatchRequestList validate(List arg, SchemaConfiguration confi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java index 8c28dd39faf..fce4321acd1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -62,16 +61,6 @@ public static Op getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -79,8 +68,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -123,7 +112,7 @@ public static class JSONPatchRequestAddReplaceTestMapInput { } - public static class JSONPatchRequestAddReplaceTest1 extends JsonSchema implements MapSchemaValidator { + public static class JSONPatchRequestAddReplaceTest1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -134,7 +123,7 @@ public static class JSONPatchRequestAddReplaceTest1 extends JsonSchema implement protected JSONPatchRequestAddReplaceTest1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("path", Path.class), new PropertyEntry("value", Value.class), @@ -156,25 +145,10 @@ public static JSONPatchRequestAddReplaceTest1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public JSONPatchRequestAddReplaceTestMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -190,7 +164,7 @@ public JSONPatchRequestAddReplaceTestMap getNewInstance(FrozenMap arg, L public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -200,9 +174,8 @@ public JSONPatchRequestAddReplaceTestMap validate(Map arg, Schem @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java index 8aab8eaeec2..e7bc441f4d4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -61,16 +60,6 @@ public static Op getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -78,8 +67,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -122,7 +111,7 @@ public static class JSONPatchRequestMoveCopyMapInput { } - public static class JSONPatchRequestMoveCopy1 extends JsonSchema implements MapSchemaValidator { + public static class JSONPatchRequestMoveCopy1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -133,7 +122,7 @@ public static class JSONPatchRequestMoveCopy1 extends JsonSchema implements MapS protected JSONPatchRequestMoveCopy1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("from", From.class), new PropertyEntry("path", Path.class), @@ -155,28 +144,13 @@ public static JSONPatchRequestMoveCopy1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public JSONPatchRequestMoveCopyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -189,7 +163,7 @@ public JSONPatchRequestMoveCopyMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -199,9 +173,8 @@ public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java index bb9661738a7..eaafaa03558 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -57,16 +56,6 @@ public static Op getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -74,8 +63,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -113,7 +102,7 @@ public static class JSONPatchRequestRemoveMapInput { } - public static class JSONPatchRequestRemove1 extends JsonSchema implements MapSchemaValidator { + public static class JSONPatchRequestRemove1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -124,7 +113,7 @@ public static class JSONPatchRequestRemove1 extends JsonSchema implements MapSch protected JSONPatchRequestRemove1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("path", Path.class), new PropertyEntry("op", Op.class) @@ -144,28 +133,13 @@ public static JSONPatchRequestRemove1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public JSONPatchRequestRemoveMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public JSONPatchRequestRemoveMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -178,7 +152,7 @@ public JSONPatchRequestRemoveMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -188,9 +162,8 @@ public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfigu @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java index 0e2b1455029..ecddce43835 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java @@ -31,7 +31,7 @@ public class Mammal { // nest classes so all schemas and input/output classes can be public - public static class Mammal1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Mammal1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -56,15 +56,6 @@ public static Mammal1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -75,18 +66,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -98,18 +79,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -121,8 +92,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -141,16 +112,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -160,8 +121,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -177,46 +138,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -224,7 +185,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -243,12 +204,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index f3aa54d404f..40b8c898a0b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.schemas.BooleanJsonSchema; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -51,12 +50,12 @@ public static class AdditionalPropertiesMapInput { } - public static class AdditionalProperties extends JsonSchema implements MapSchemaValidator { + public static class AdditionalProperties extends JsonSchema implements MapSchemaValidator { private static AdditionalProperties instance; protected AdditionalProperties() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties1.class) ); } @@ -68,28 +67,13 @@ public static AdditionalProperties getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public AdditionalPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -102,7 +86,7 @@ public AdditionalPropertiesMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -112,9 +96,8 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfigura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -141,12 +124,12 @@ public static class MapMapOfStringMapInput { } - public static class MapMapOfString extends JsonSchema implements MapSchemaValidator, FrozenMap, MapMapOfStringMap> { + public static class MapMapOfString extends JsonSchema implements MapSchemaValidator, MapMapOfStringMap> { private static MapMapOfString instance; protected MapMapOfString() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties.class) ); } @@ -158,28 +141,13 @@ public static MapMapOfString getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - Map val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MapMapOfStringMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenMap value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); AdditionalPropertiesMap castValue = (AdditionalPropertiesMap) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -192,7 +160,7 @@ public MapMapOfStringMap getNewInstance(FrozenMap> arg, List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -202,9 +170,8 @@ public MapMapOfStringMap validate(Map> arg, SchemaCo @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -233,16 +200,6 @@ public static AdditionalProperties2 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -250,8 +207,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -283,12 +240,12 @@ public static class MapOfEnumStringMapInput { } - public static class MapOfEnumString extends JsonSchema implements MapSchemaValidator { + public static class MapOfEnumString extends JsonSchema implements MapSchemaValidator { private static MapOfEnumString instance; protected MapOfEnumString() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties2.class) ); } @@ -300,28 +257,13 @@ public static MapOfEnumString getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MapOfEnumStringMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -334,7 +276,7 @@ public MapOfEnumStringMap getNewInstance(FrozenMap arg, List pat public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -344,9 +286,8 @@ public MapOfEnumStringMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -376,12 +317,12 @@ public static class DirectMapMapInput { } - public static class DirectMap extends JsonSchema implements MapSchemaValidator { + public static class DirectMap extends JsonSchema implements MapSchemaValidator { private static DirectMap instance; protected DirectMap() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties3.class) ); } @@ -393,28 +334,13 @@ public static DirectMap getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Boolean val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Boolean fixedVal = (Boolean) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public DirectMapMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public DirectMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Boolean value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Boolean castValue = (Boolean) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -427,7 +353,7 @@ public DirectMapMap getNewInstance(FrozenMap arg, List pathToIt public DirectMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -437,9 +363,8 @@ public DirectMapMap validate(Map arg, SchemaConfiguration confi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -496,7 +421,7 @@ public static class MapTestMapInput { } - public static class MapTest1 extends JsonSchema implements MapSchemaValidator { + public static class MapTest1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -507,7 +432,7 @@ public static class MapTest1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MapTestMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -558,7 +468,7 @@ public MapTestMap getNewInstance(FrozenMap arg, List pathToItem, public MapTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -568,9 +478,8 @@ public MapTestMap validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java index f90f7a3ad17..efb3582bbb4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; import org.openapijsonschematools.client.schemas.UuidJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class MapMapInput { } - public static class MapSchema extends JsonSchema implements MapSchemaValidator, FrozenMap, MapMap> { + public static class MapSchema extends JsonSchema implements MapSchemaValidator, MapMap> { private static MapSchema instance; protected MapSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(Animal.Animal1.class) ); } @@ -69,28 +68,13 @@ public static MapSchema getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - Map val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MapMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenMap value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Animal.AnimalMap castValue = (Animal.AnimalMap) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -103,7 +87,7 @@ public MapMap getNewInstance(FrozenMap> arg, List path public MapMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -113,9 +97,8 @@ public MapMap validate(Map> arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -153,7 +136,7 @@ public static class MixedPropertiesAndAdditionalPropertiesClassMapInput { } - public static class MixedPropertiesAndAdditionalPropertiesClass1 extends JsonSchema implements MapSchemaValidator { + public static class MixedPropertiesAndAdditionalPropertiesClass1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -164,7 +147,7 @@ public static class MixedPropertiesAndAdditionalPropertiesClass1 extends JsonSch protected MixedPropertiesAndAdditionalPropertiesClass1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("uuid", UuidSchema.class), new PropertyEntry("dateTime", DateTime.class), @@ -180,25 +163,10 @@ public static MixedPropertiesAndAdditionalPropertiesClass1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -214,7 +182,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(FrozenMap arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -224,9 +192,8 @@ public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java index a3b1e5aa02c..1c5202d46ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.DecimalJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -60,7 +59,7 @@ public static class MoneyMapInput { } - public static class Money1 extends JsonSchema implements MapSchemaValidator { + public static class Money1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -71,7 +70,7 @@ public static class Money1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MoneyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -125,7 +109,7 @@ public MoneyMap getNewInstance(FrozenMap arg, List pathToItem, P public MoneyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -135,9 +119,8 @@ public MoneyMap validate(Map arg, SchemaConfiguration configurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java index 1bba0b5773d..f454264e6cc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.UuidJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -57,7 +56,7 @@ public static class MyObjectDtoMapInput { } - public static class MyObjectDto1 extends JsonSchema implements MapSchemaValidator { + public static class MyObjectDto1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -68,7 +67,7 @@ public static class MyObjectDto1 extends JsonSchema implements MapSchemaValidato protected MyObjectDto1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("id", Id.class) )) @@ -83,28 +82,13 @@ public static MyObjectDto1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public MyObjectDtoMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -117,7 +101,7 @@ public MyObjectDtoMap getNewInstance(FrozenMap arg, List pathToI public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -127,9 +111,8 @@ public MyObjectDtoMap validate(Map arg, SchemaConfiguration conf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java index fef1a70815a..0a0a9c7eb38 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java @@ -85,7 +85,7 @@ public static class NameMapInput { } - public static class Name1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Name1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -115,15 +115,6 @@ public static Name1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -134,18 +125,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -157,18 +138,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -180,8 +151,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -200,16 +171,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -219,8 +180,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -236,53 +197,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public NameMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -294,7 +244,7 @@ public NameMap validate(Map arg, SchemaConfiguration configurati Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -313,12 +263,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java index 841d7552df7..9bebe780fb1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.Int64JsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -66,7 +65,7 @@ public static class NoAdditionalPropertiesMapInput { } - public static class NoAdditionalProperties1 extends JsonSchema implements MapSchemaValidator { + public static class NoAdditionalProperties1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -77,7 +76,7 @@ public static class NoAdditionalProperties1 extends JsonSchema implements MapSch protected NoAdditionalProperties1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("id", Id.class), new PropertyEntry("petId", PetId.class) @@ -96,28 +95,13 @@ public static NoAdditionalProperties1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Long val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Long fixedVal = (Long) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public NoAdditionalPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NoAdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Long value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Long castValue = (Long) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -130,7 +114,7 @@ public NoAdditionalPropertiesMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -140,9 +124,8 @@ public NoAdditionalPropertiesMap validate(Map arg, SchemaConfigura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index ac8cfd62dc8..926847d9a5f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -33,14 +32,14 @@ public class NullableClass { // nest classes so all schemas and input/output classes can be public - public static class AdditionalProperties3 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { + public static class AdditionalProperties3 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { private static AdditionalProperties3 instance; protected AdditionalProperties3() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) ); } @@ -52,16 +51,6 @@ public static AdditionalProperties3 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -69,35 +58,30 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -109,9 +93,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -139,16 +122,6 @@ public static IntegerProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -156,18 +129,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -177,8 +140,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -230,16 +193,6 @@ public static NumberProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -247,18 +200,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -269,7 +212,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); @@ -317,16 +260,6 @@ public static BooleanProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -334,18 +267,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -355,8 +278,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -390,16 +313,6 @@ public static StringProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -407,18 +320,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -428,8 +331,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -463,16 +366,6 @@ public static DateProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -480,18 +373,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -501,8 +384,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -536,16 +419,6 @@ public static DatetimeProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -553,18 +426,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -574,8 +437,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -606,14 +469,14 @@ public static class ArrayNullablePropListInput { } - public static class ArrayNullableProp extends JsonSchema implements NullSchemaValidator, ListSchemaValidator, FrozenMap, ArrayNullablePropList> { + public static class ArrayNullableProp extends JsonSchema implements NullSchemaValidator, ListSchemaValidator, ArrayNullablePropList> { private static ArrayNullableProp instance; protected ArrayNullableProp() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenList.class + List.class )) .items(Items.class) ); @@ -626,16 +489,6 @@ public static ArrayNullableProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -643,34 +496,19 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayNullablePropList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList> items = new ArrayList<>(); + public ArrayNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List> items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - FrozenMap castItem = (FrozenMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + FrozenMap castItem = (FrozenMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -682,7 +520,7 @@ public ArrayNullablePropList getNewInstance(FrozenList> arg, L public ArrayNullablePropList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -693,22 +531,21 @@ public ArrayNullablePropList validate(List> arg, SchemaConfi public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Items1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { + public static class Items1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { private static Items1 instance; protected Items1() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) ); } @@ -720,16 +557,6 @@ public static Items1 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -737,35 +564,30 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -777,9 +599,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -799,14 +620,14 @@ public static class ArrayAndItemsNullablePropListInput { } - public static class ArrayAndItemsNullableProp extends JsonSchema implements NullSchemaValidator, ListSchemaValidator, FrozenMap, ArrayAndItemsNullablePropList> { + public static class ArrayAndItemsNullableProp extends JsonSchema implements NullSchemaValidator, ListSchemaValidator, ArrayAndItemsNullablePropList> { private static ArrayAndItemsNullableProp instance; protected ArrayAndItemsNullableProp() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenList.class + List.class )) .items(Items1.class) ); @@ -819,16 +640,6 @@ public static ArrayAndItemsNullableProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -836,34 +647,19 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayAndItemsNullablePropList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList> items = new ArrayList<>(); + public ArrayAndItemsNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List> items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - FrozenMap castItem = (FrozenMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + FrozenMap castItem = (FrozenMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -875,7 +671,7 @@ public ArrayAndItemsNullablePropList getNewInstance(FrozenList public ArrayAndItemsNullablePropList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -886,22 +682,21 @@ public ArrayAndItemsNullablePropList validate(List> arg, Sch public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class Items2 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { + public static class Items2 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { private static Items2 instance; protected Items2() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) ); } @@ -913,16 +708,6 @@ public static Items2 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -930,35 +715,30 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -970,9 +750,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -992,12 +771,12 @@ public static class ArrayItemsNullableListInput { } - public static class ArrayItemsNullable extends JsonSchema implements ListSchemaValidator, FrozenMap, ArrayItemsNullableList> { + public static class ArrayItemsNullable extends JsonSchema implements ListSchemaValidator, ArrayItemsNullableList> { private static ArrayItemsNullable instance; protected ArrayItemsNullable() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items2.class) ); } @@ -1010,29 +789,14 @@ public static ArrayItemsNullable getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayItemsNullableList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList> items = new ArrayList<>(); + public ArrayItemsNullableList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List> items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - FrozenMap castItem = (FrozenMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + FrozenMap castItem = (FrozenMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -1044,7 +808,7 @@ public ArrayItemsNullableList getNewInstance(FrozenList> arg, public ArrayItemsNullableList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -1053,9 +817,8 @@ public ArrayItemsNullableList validate(List> arg, SchemaConf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -1084,14 +847,14 @@ public static class ObjectNullablePropMapInput { } - public static class ObjectNullableProp extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, FrozenMap, ObjectNullablePropMap> { + public static class ObjectNullableProp extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, ObjectNullablePropMap> { private static ObjectNullableProp instance; protected ObjectNullableProp() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) .additionalProperties(AdditionalProperties.class) ); @@ -1104,16 +867,6 @@ public static ObjectNullableProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -1121,32 +874,17 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - Map val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - public ObjectNullablePropMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap> properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenMap value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); FrozenMap castValue = (FrozenMap) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -1159,7 +897,7 @@ public ObjectNullablePropMap getNewInstance(FrozenMap> arg, Li public ObjectNullablePropMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -1171,22 +909,21 @@ public ObjectNullablePropMap validate(Map> arg, Sche public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class AdditionalProperties1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { + public static class AdditionalProperties1 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { private static AdditionalProperties1 instance; protected AdditionalProperties1() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) ); } @@ -1198,16 +935,6 @@ public static AdditionalProperties1 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -1215,35 +942,30 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -1255,9 +977,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -1283,14 +1004,14 @@ public static class ObjectAndItemsNullablePropMapInput { } - public static class ObjectAndItemsNullableProp extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, FrozenMap, ObjectAndItemsNullablePropMap> { + public static class ObjectAndItemsNullableProp extends JsonSchema implements NullSchemaValidator, MapSchemaValidator, ObjectAndItemsNullablePropMap> { private static ObjectAndItemsNullableProp instance; protected ObjectAndItemsNullableProp() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) .additionalProperties(AdditionalProperties1.class) ); @@ -1303,16 +1024,6 @@ public static ObjectAndItemsNullableProp getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -1320,32 +1031,17 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - Map val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectAndItemsNullablePropMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap> properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenMap value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); FrozenMap castValue = (FrozenMap) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -1358,7 +1054,7 @@ public ObjectAndItemsNullablePropMap getNewInstance(FrozenMap> public ObjectAndItemsNullablePropMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -1370,22 +1066,21 @@ public ObjectAndItemsNullablePropMap validate(Map> a public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class AdditionalProperties2 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { + public static class AdditionalProperties2 extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { private static AdditionalProperties2 instance; protected AdditionalProperties2() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) ); } @@ -1397,16 +1092,6 @@ public static AdditionalProperties2 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -1414,35 +1099,30 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -1454,9 +1134,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -1482,12 +1161,12 @@ public static class ObjectItemsNullableMapInput { } - public static class ObjectItemsNullable extends JsonSchema implements MapSchemaValidator, FrozenMap, ObjectItemsNullableMap> { + public static class ObjectItemsNullable extends JsonSchema implements MapSchemaValidator, ObjectItemsNullableMap> { private static ObjectItemsNullable instance; protected ObjectItemsNullable() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties2.class) ); } @@ -1499,28 +1178,13 @@ public static ObjectItemsNullable getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - Map val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectItemsNullableMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectItemsNullableMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap> properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenMap value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); FrozenMap castValue = (FrozenMap) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -1533,7 +1197,7 @@ public ObjectItemsNullableMap getNewInstance(FrozenMap> arg, L public ObjectItemsNullableMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -1543,9 +1207,8 @@ public ObjectItemsNullableMap validate(Map> arg, Sch @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -1657,7 +1320,7 @@ public static class NullableClassMapInput { } - public static class NullableClass1 extends JsonSchema implements MapSchemaValidator { + public static class NullableClass1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -1668,7 +1331,7 @@ public static class NullableClass1 extends JsonSchema implements MapSchemaValida protected NullableClass1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("integer_prop", IntegerProp.class), new PropertyEntry("number_prop", NumberProp.class), @@ -1694,25 +1357,10 @@ public static NullableClass1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public NullableClassMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NullableClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -1728,7 +1376,7 @@ public NullableClassMap getNewInstance(FrozenMap arg, List pathT public NullableClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -1738,9 +1386,8 @@ public NullableClassMap validate(Map arg, SchemaConfiguration co @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java index 63a366c25a6..aff4dd936d6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java @@ -35,7 +35,7 @@ public class NullableShape { public static class Schema2 extends NullJsonSchema {} - public static class NullableShape1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class NullableShape1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -62,15 +62,6 @@ public static NullableShape1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -81,18 +72,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -104,18 +85,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -127,8 +98,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -147,16 +118,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -166,8 +127,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -183,46 +144,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -230,7 +191,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -249,12 +210,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java index 850e2fef970..bb3d2bddb2b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java @@ -49,16 +49,6 @@ public static NullableString1 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -66,18 +56,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -87,8 +67,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java index 77bf9a1db3d..6d764274b72 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java @@ -56,7 +56,7 @@ public static class NumberOnlyMapInput { } - public static class NumberOnly1 extends JsonSchema implements MapSchemaValidator { + public static class NumberOnly1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -67,7 +67,7 @@ public static class NumberOnly1 extends JsonSchema implements MapSchemaValidator protected NumberOnly1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("JustNumber", JustNumber.class) )) @@ -81,25 +81,10 @@ public static NumberOnly1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public NumberOnlyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -115,7 +100,7 @@ public NumberOnlyMap getNewInstance(FrozenMap arg, List pathToIt public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -125,9 +110,8 @@ public NumberOnlyMap validate(Map arg, SchemaConfiguration confi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java index 984e1ad8050..ea60f9bc9e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java @@ -50,16 +50,6 @@ public static NumberWithExclusiveMinMax1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,7 +58,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java index 86ba33f5420..f0550d5e5a4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java @@ -50,16 +50,6 @@ public static NumberWithValidations1 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,7 +58,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java index e14bced0601..5de3a7d4ef9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java @@ -54,7 +54,7 @@ public static class ObjWithRequiredPropsMapInput { } - public static class ObjWithRequiredProps1 extends JsonSchema implements MapSchemaValidator { + public static class ObjWithRequiredProps1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -65,7 +65,7 @@ public static class ObjWithRequiredProps1 extends JsonSchema implements MapSchem protected ObjWithRequiredProps1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("a", A.class) )) @@ -85,25 +85,10 @@ public static ObjWithRequiredProps1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjWithRequiredPropsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -119,7 +104,7 @@ public ObjWithRequiredPropsMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -129,9 +114,8 @@ public ObjWithRequiredPropsMap validate(Map arg, SchemaConfigura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java index d8a9d61b918..7b26e6bb187 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java @@ -54,7 +54,7 @@ public static class ObjWithRequiredPropsBaseMapInput { } - public static class ObjWithRequiredPropsBase1 extends JsonSchema implements MapSchemaValidator { + public static class ObjWithRequiredPropsBase1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -65,7 +65,7 @@ public static class ObjWithRequiredPropsBase1 extends JsonSchema implements MapS protected ObjWithRequiredPropsBase1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("b", B.class) )) @@ -82,25 +82,10 @@ public static ObjWithRequiredPropsBase1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjWithRequiredPropsBaseMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -116,7 +101,7 @@ public ObjWithRequiredPropsBaseMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -126,9 +111,8 @@ public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java index 0374ccbedd5..873c2d81f01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java @@ -62,7 +62,7 @@ public static class ObjectModelWithArgAndArgsPropertiesMapInput { } - public static class ObjectModelWithArgAndArgsProperties1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectModelWithArgAndArgsProperties1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -73,7 +73,7 @@ public static class ObjectModelWithArgAndArgsProperties1 extends JsonSchema impl protected ObjectModelWithArgAndArgsProperties1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("arg", Arg.class), new PropertyEntry("args", Args.class) @@ -92,25 +92,10 @@ public static ObjectModelWithArgAndArgsProperties1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -126,7 +111,7 @@ public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(FrozenMap a public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -136,9 +121,8 @@ public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java index f6c84da030e..89c2297f45a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java @@ -66,7 +66,7 @@ public static class ObjectModelWithRefPropsMapInput { } - public static class ObjectModelWithRefProps1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectModelWithRefProps1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -79,7 +79,7 @@ a model that includes properties which should stay primitive (String + Boolean) protected ObjectModelWithRefProps1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("myNumber", NumberWithValidations.NumberWithValidations1.class), new PropertyEntry("myString", StringSchema.StringSchema1.class), @@ -95,25 +95,10 @@ public static ObjectModelWithRefProps1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectModelWithRefPropsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -129,7 +114,7 @@ public ObjectModelWithRefPropsMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -139,9 +124,8 @@ public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfig @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java index 155f9585d90..4aac1a823ea 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java @@ -71,12 +71,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("name", Name.class) )) @@ -93,25 +93,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -127,7 +112,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -137,16 +122,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -170,15 +154,6 @@ public static ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -189,18 +164,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -212,18 +177,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -235,8 +190,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -255,16 +210,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -274,8 +219,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -291,46 +236,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -338,7 +283,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -357,12 +302,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java index 8e31a019d4c..5089cb3bad9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java @@ -66,7 +66,7 @@ public static class ObjectWithCollidingPropertiesMapInput { } - public static class ObjectWithCollidingProperties1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithCollidingProperties1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -79,7 +79,7 @@ public static class ObjectWithCollidingProperties1 extends JsonSchema implements protected ObjectWithCollidingProperties1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someProp", SomeProp.class), new PropertyEntry("someprop", Someprop.class) @@ -94,25 +94,10 @@ public static ObjectWithCollidingProperties1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectWithCollidingPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -128,7 +113,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(FrozenMap arg, Li public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -138,9 +123,8 @@ public ObjectWithCollidingPropertiesMap validate(Map arg, Schema @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java index 30b04c87f50..e9f0e304eca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java @@ -70,7 +70,7 @@ public static class ObjectWithDecimalPropertiesMapInput { } - public static class ObjectWithDecimalProperties1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithDecimalProperties1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -81,7 +81,7 @@ public static class ObjectWithDecimalProperties1 extends JsonSchema implements M protected ObjectWithDecimalProperties1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("length", DecimalPayload.DecimalPayload1.class), new PropertyEntry("width", Width.class), @@ -97,25 +97,10 @@ public static ObjectWithDecimalProperties1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectWithDecimalPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -131,7 +116,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(FrozenMap arg, List public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -141,9 +126,8 @@ public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaCo @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java index 667ce94d14f..c36851c6a3a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java @@ -61,7 +61,7 @@ public static class ObjectWithDifficultlyNamedPropsMapInput { } - public static class ObjectWithDifficultlyNamedProps1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithDifficultlyNamedProps1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -74,7 +74,7 @@ public static class ObjectWithDifficultlyNamedProps1 extends JsonSchema implemen protected ObjectWithDifficultlyNamedProps1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("$special[property.name]", Specialpropertyname.class), new PropertyEntry("123-list", Schema123list.class), @@ -93,25 +93,10 @@ public static ObjectWithDifficultlyNamedProps1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectWithDifficultlyNamedPropsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -127,7 +112,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(FrozenMap arg, public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -137,9 +122,8 @@ public ObjectWithDifficultlyNamedPropsMap validate(Map arg, Sche @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java index 286aa546575..7e17bc9c419 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java @@ -51,16 +51,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,8 +58,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -81,7 +71,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class SomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class SomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static SomeProp instance; protected SomeProp() { @@ -98,15 +88,6 @@ public static SomeProp getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -117,18 +98,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -140,18 +111,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -163,8 +124,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -183,16 +144,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -202,8 +153,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -219,46 +170,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -266,7 +217,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -285,12 +236,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -325,7 +274,7 @@ public static class ObjectWithInlineCompositionPropertyMapInput { } - public static class ObjectWithInlineCompositionProperty1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithInlineCompositionProperty1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -336,7 +285,7 @@ public static class ObjectWithInlineCompositionProperty1 extends JsonSchema impl protected ObjectWithInlineCompositionProperty1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someProp", SomeProp.class) )) @@ -350,25 +299,10 @@ public static ObjectWithInlineCompositionProperty1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectWithInlineCompositionPropertyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -384,7 +318,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(FrozenMap a public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -394,9 +328,8 @@ public ObjectWithInlineCompositionPropertyMap validate(Map arg, @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java index f3f8b60d571..b00dce6052f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java @@ -51,7 +51,7 @@ public static class ObjectWithInvalidNamedRefedPropertiesMapInput { } - public static class ObjectWithInvalidNamedRefedProperties1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithInvalidNamedRefedProperties1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -62,7 +62,7 @@ public static class ObjectWithInvalidNamedRefedProperties1 extends JsonSchema im protected ObjectWithInvalidNamedRefedProperties1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("from", FromSchema.FromSchema1.class), new PropertyEntry("!reference", ArrayWithValidationsInItems.ArrayWithValidationsInItems1.class) @@ -81,25 +81,10 @@ public static ObjectWithInvalidNamedRefedProperties1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -115,7 +100,7 @@ public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(FrozenMap public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -125,9 +110,8 @@ public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java index 2050a1bcb1c..8c254782868 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NumberJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -60,7 +59,7 @@ public static class ObjectWithNonIntersectingValuesMapInput { } - public static class ObjectWithNonIntersectingValues1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithNonIntersectingValues1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -71,7 +70,7 @@ public static class ObjectWithNonIntersectingValues1 extends JsonSchema implemen protected ObjectWithNonIntersectingValues1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("a", A.class) )) @@ -86,25 +85,10 @@ public static ObjectWithNonIntersectingValues1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectWithNonIntersectingValuesMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -120,7 +104,7 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(FrozenMap arg, public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -130,9 +114,8 @@ public ObjectWithNonIntersectingValuesMap validate(Map arg, Sche @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java index 5860d7008b9..bb2b50c6e53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NumberJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -68,7 +67,7 @@ public static class ObjectWithOnlyOptionalPropsMapInput { } - public static class ObjectWithOnlyOptionalProps1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithOnlyOptionalProps1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -79,7 +78,7 @@ public static class ObjectWithOnlyOptionalProps1 extends JsonSchema implements M protected ObjectWithOnlyOptionalProps1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("a", A.class), new PropertyEntry("b", B.class) @@ -95,25 +94,10 @@ public static ObjectWithOnlyOptionalProps1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectWithOnlyOptionalPropsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -129,7 +113,7 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(FrozenMap arg, List public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -139,9 +123,8 @@ public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaCo @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java index bdb05c7dcf6..a5535641b90 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java @@ -56,7 +56,7 @@ public static class ObjectWithOptionalTestPropMapInput { } - public static class ObjectWithOptionalTestProp1 extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithOptionalTestProp1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -67,7 +67,7 @@ public static class ObjectWithOptionalTestProp1 extends JsonSchema implements Ma protected ObjectWithOptionalTestProp1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("test", Test.class) )) @@ -81,25 +81,10 @@ public static ObjectWithOptionalTestProp1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ObjectWithOptionalTestPropMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -115,7 +100,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(FrozenMap arg, List< public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -125,9 +110,8 @@ public ObjectWithOptionalTestPropMap validate(Map arg, SchemaCon @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java index d84f13859b4..ee8c36fb20f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java @@ -22,7 +22,7 @@ public class ObjectWithValidations { // nest classes so all schemas and input/output classes can be public - public static class ObjectWithValidations1 extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithValidations1 extends JsonSchema implements MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -33,7 +33,7 @@ public static class ObjectWithValidations1 extends JsonSchema implements MapSche protected ObjectWithValidations1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .minProperties(2) ); } @@ -45,31 +45,26 @@ public static ObjectWithValidations1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -79,9 +74,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java index 2b0e575c374..42405331c40 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java @@ -64,16 +64,6 @@ public static Status getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -81,8 +71,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -161,7 +151,7 @@ public static class OrderMapInput { } - public static class Order1 extends JsonSchema implements MapSchemaValidator { + public static class Order1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -172,7 +162,7 @@ public static class Order1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public OrderMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public OrderMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -225,7 +200,7 @@ public OrderMap getNewInstance(FrozenMap arg, List pathToItem, P public OrderMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -235,9 +210,8 @@ public OrderMap validate(Map arg, SchemaConfiguration configurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java index 3c0f2fb8815..32c7c4412e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.IntJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -50,12 +49,12 @@ public static class ResultsListInput { } - public static class Results extends JsonSchema implements ListSchemaValidator, FrozenMap, ResultsList> { + public static class Results extends JsonSchema implements ListSchemaValidator, ResultsList> { private static Results instance; protected Results() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(MyObjectDto.MyObjectDto1.class) ); } @@ -68,29 +67,14 @@ public static Results getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ResultsList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public ResultsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - MyObjectDto.MyObjectDtoMap castItem = (MyObjectDto.MyObjectDtoMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + MyObjectDto.MyObjectDtoMap castItem = (MyObjectDto.MyObjectDtoMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -102,7 +86,7 @@ public ResultsList getNewInstance(FrozenList> arg, List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -111,9 +95,8 @@ public ResultsList validate(List> arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -145,7 +128,7 @@ public static class PaginatedResultMyObjectDtoMapInput { } - public static class PaginatedResultMyObjectDto1 extends JsonSchema implements MapSchemaValidator { + public static class PaginatedResultMyObjectDto1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -156,7 +139,7 @@ public static class PaginatedResultMyObjectDto1 extends JsonSchema implements Ma protected PaginatedResultMyObjectDto1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("count", Count.class), new PropertyEntry("results", Results.class) @@ -176,25 +159,10 @@ public static PaginatedResultMyObjectDto1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PaginatedResultMyObjectDtoMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -210,7 +178,7 @@ public PaginatedResultMyObjectDtoMap getNewInstance(FrozenMap arg, List< public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -220,9 +188,8 @@ public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaCon @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java index 4ef0e6baed0..bddd7eae9d6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java @@ -22,7 +22,7 @@ public class ParentPet { // nest classes so all schemas and input/output classes can be public - public static class ParentPet1 extends JsonSchema implements MapSchemaValidator> { + public static class ParentPet1 extends JsonSchema implements MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -33,7 +33,7 @@ public static class ParentPet1 extends JsonSchema implements MapSchemaValidator< protected ParentPet1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .allOf(List.of( GrandparentAnimal.GrandparentAnimal1.class )) @@ -47,31 +47,26 @@ public static ParentPet1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -81,9 +76,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index 97f8ddd9272..87f8a227ca1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -52,12 +52,12 @@ public static class PhotoUrlsListInput { } - public static class PhotoUrls extends JsonSchema implements ListSchemaValidator { + public static class PhotoUrls extends JsonSchema implements ListSchemaValidator { private static PhotoUrls instance; protected PhotoUrls() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -70,29 +70,14 @@ public static PhotoUrls getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public PhotoUrlsList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -104,7 +89,7 @@ public PhotoUrlsList getNewInstance(FrozenList arg, List pathToI public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -113,9 +98,8 @@ public PhotoUrlsList validate(List arg, SchemaConfiguration configuratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -144,16 +128,6 @@ public static Status getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -161,8 +135,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -188,12 +162,12 @@ public static class TagsListInput { } - public static class Tags extends JsonSchema implements ListSchemaValidator, FrozenMap, TagsList> { + public static class Tags extends JsonSchema implements ListSchemaValidator, TagsList> { private static Tags instance; protected Tags() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Tag.Tag1.class) ); } @@ -206,29 +180,14 @@ public static Tags getInstance() { } @Override - public FrozenList> castToAllowedTypes(List> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List> argFixed = new ArrayList<>(); - int i =0; - for (Map item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public TagsList getNewInstance(FrozenList> arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public TagsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenMap item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - Tag.TagMap castItem = (Tag.TagMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + Tag.TagMap castItem = (Tag.TagMap) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -240,7 +199,7 @@ public TagsList getNewInstance(FrozenList> arg, List p public TagsList validate(List> arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -249,9 +208,8 @@ public TagsList validate(List> arg, SchemaConfiguration conf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList> castArg = (FrozenList>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -318,7 +276,7 @@ public static class PetMapInput { } - public static class Pet1 extends JsonSchema implements MapSchemaValidator { + public static class Pet1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -331,7 +289,7 @@ public static class Pet1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PetMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PetMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -388,7 +331,7 @@ public PetMap getNewInstance(FrozenMap arg, List pathToItem, Pat public PetMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -398,9 +341,8 @@ public PetMap validate(Map arg, SchemaConfiguration configuratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java index ebdc2d18542..cc92ca94cfa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java @@ -31,7 +31,7 @@ public class Pig { // nest classes so all schemas and input/output classes can be public - public static class Pig1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Pig1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -55,15 +55,6 @@ public static Pig1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -74,18 +65,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -97,18 +78,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -120,8 +91,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -140,16 +111,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -159,8 +120,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -176,46 +137,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -223,7 +184,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -242,12 +203,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java index ff22fa1bc69..f2726ccdbde 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java @@ -63,7 +63,7 @@ public static class PlayerMapInput { } - public static class Player1 extends JsonSchema implements MapSchemaValidator { + public static class Player1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -76,7 +76,7 @@ public static class Player1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PlayerMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -125,7 +110,7 @@ public PlayerMap getNewInstance(FrozenMap arg, List pathToItem, public PlayerMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -135,9 +120,8 @@ public PlayerMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java index 91dd1cafbe9..5f5d484cee2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java @@ -56,7 +56,7 @@ public static class PublicKeyMapInput { } - public static class PublicKey1 extends JsonSchema implements MapSchemaValidator { + public static class PublicKey1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -69,7 +69,7 @@ public static class PublicKey1 extends JsonSchema implements MapSchemaValidator< protected PublicKey1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("key", Key.class) )) @@ -83,25 +83,10 @@ public static PublicKey1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PublicKeyMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -117,7 +102,7 @@ public PublicKeyMap getNewInstance(FrozenMap arg, List pathToIte public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -127,9 +112,8 @@ public PublicKeyMap validate(Map arg, SchemaConfiguration config @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java index d1524c46ae0..054c3c9e401 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java @@ -31,7 +31,7 @@ public class Quadrilateral { // nest classes so all schemas and input/output classes can be public - public static class Quadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Quadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -55,15 +55,6 @@ public static Quadrilateral1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -74,18 +65,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -97,18 +78,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -120,8 +91,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -140,16 +111,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -159,8 +120,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -176,46 +137,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -223,7 +184,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -242,12 +203,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java index 10591454d55..ee7b52fe597 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java @@ -55,16 +55,6 @@ public static ShapeType getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -72,8 +62,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -120,7 +110,7 @@ public static class QuadrilateralInterfaceMapInput { } - public static class QuadrilateralInterface1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class QuadrilateralInterface1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -148,15 +138,6 @@ public static QuadrilateralInterface1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -167,18 +148,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -190,18 +161,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -213,8 +174,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -233,16 +194,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -252,8 +203,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -269,53 +220,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public QuadrilateralInterfaceMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QuadrilateralInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -327,7 +267,7 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfigu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -346,12 +286,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java index 3ac00c093aa..18e1933a668 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java @@ -66,7 +66,7 @@ public static class ReadOnlyFirstMapInput { } - public static class ReadOnlyFirst1 extends JsonSchema implements MapSchemaValidator { + public static class ReadOnlyFirst1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -77,7 +77,7 @@ public static class ReadOnlyFirst1 extends JsonSchema implements MapSchemaValida protected ReadOnlyFirst1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("bar", Bar.class), new PropertyEntry("baz", Baz.class) @@ -92,25 +92,10 @@ public static ReadOnlyFirst1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ReadOnlyFirstMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -126,7 +111,7 @@ public ReadOnlyFirstMap getNewInstance(FrozenMap arg, List pathT public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -136,9 +121,8 @@ public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration co @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java index a70a2b08fe8..c45729ff2c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,7 +53,7 @@ public static class ReqPropsFromExplicitAddPropsMapInput { } - public static class ReqPropsFromExplicitAddProps1 extends JsonSchema implements MapSchemaValidator { + public static class ReqPropsFromExplicitAddProps1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -65,7 +64,7 @@ public static class ReqPropsFromExplicitAddProps1 extends JsonSchema implements protected ReqPropsFromExplicitAddProps1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .required(Set.of( "invalid-name", "validName" @@ -81,28 +80,13 @@ public static ReqPropsFromExplicitAddProps1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ReqPropsFromExplicitAddPropsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -115,7 +99,7 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(FrozenMap arg, Lis public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -125,9 +109,8 @@ public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaC @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java index c7b58501c73..28cb4020cee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,7 +53,7 @@ public static class ReqPropsFromTrueAddPropsMapInput { } - public static class ReqPropsFromTrueAddProps1 extends JsonSchema implements MapSchemaValidator { + public static class ReqPropsFromTrueAddProps1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -65,7 +64,7 @@ public static class ReqPropsFromTrueAddProps1 extends JsonSchema implements MapS protected ReqPropsFromTrueAddProps1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .required(Set.of( "invalid-name", "validName" @@ -81,25 +80,10 @@ public static ReqPropsFromTrueAddProps1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ReqPropsFromTrueAddPropsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -115,7 +99,7 @@ public ReqPropsFromTrueAddPropsMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -125,9 +109,8 @@ public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfi @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java index 12eaed39857..f88194e74d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java @@ -50,7 +50,7 @@ public static class ReqPropsFromUnsetAddPropsMapInput { } - public static class ReqPropsFromUnsetAddProps1 extends JsonSchema implements MapSchemaValidator { + public static class ReqPropsFromUnsetAddProps1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -61,7 +61,7 @@ public static class ReqPropsFromUnsetAddProps1 extends JsonSchema implements Map protected ReqPropsFromUnsetAddProps1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .required(Set.of( "invalid-name", "validName" @@ -76,25 +76,10 @@ public static ReqPropsFromUnsetAddProps1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ReqPropsFromUnsetAddPropsMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -110,7 +95,7 @@ public ReqPropsFromUnsetAddPropsMap getNewInstance(FrozenMap arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -120,9 +105,8 @@ public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConf @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java index a1c5babf571..ed4fb038eae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java @@ -59,7 +59,7 @@ public static class ReturnMapInput { } - public static class ReturnSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class ReturnSchema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -84,15 +84,6 @@ public static ReturnSchema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -103,18 +94,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -126,18 +107,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -149,8 +120,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -169,16 +140,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -188,8 +149,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -205,53 +166,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public ReturnMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -263,7 +213,7 @@ public ReturnMap validate(Map arg, SchemaConfiguration configura Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -282,12 +232,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java index 2cee3f00f88..c90e124c271 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java @@ -54,16 +54,6 @@ public static TriangleType getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -71,8 +61,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -113,12 +103,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("triangleType", TriangleType.class) )) @@ -132,25 +122,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -166,7 +141,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -176,16 +151,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class ScaleneTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ScaleneTriangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -209,15 +183,6 @@ public static ScaleneTriangle1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -228,18 +193,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -251,18 +206,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -274,8 +219,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -294,16 +239,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -313,8 +248,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -330,46 +265,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -377,7 +312,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -396,12 +331,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java index 912cdded12d..d581c330842 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java @@ -70,7 +70,7 @@ public static class Schema200ResponseMapInput { } - public static class Schema200Response1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class Schema200Response1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -96,15 +96,6 @@ public static Schema200Response1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -115,18 +106,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -138,18 +119,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -161,8 +132,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -181,16 +152,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -200,8 +161,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -217,53 +178,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public Schema200ResponseMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema200ResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -275,7 +225,7 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguratio Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -294,12 +244,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java index b99de835461..8487778bd85 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java @@ -36,7 +36,7 @@ public static class SelfReferencingArrayModelListInput { } - public static class SelfReferencingArrayModel1 extends JsonSchema implements ListSchemaValidator { + public static class SelfReferencingArrayModel1 extends JsonSchema implements ListSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -47,7 +47,7 @@ public static class SelfReferencingArrayModel1 extends JsonSchema implements Lis protected SelfReferencingArrayModel1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(SelfReferencingArrayModel1.class) ); } @@ -60,29 +60,14 @@ public static SelfReferencingArrayModel1 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (List item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - FrozenList fixedVal = (FrozenList) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SelfReferencingArrayModelList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SelfReferencingArrayModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (FrozenList item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - SelfReferencingArrayModelList castItem = (SelfReferencingArrayModelList) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + SelfReferencingArrayModelList castItem = (SelfReferencingArrayModelList) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -94,7 +79,7 @@ public SelfReferencingArrayModelList getNewInstance(FrozenList arg, public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -103,9 +88,8 @@ public SelfReferencingArrayModelList validate(List arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java index aa482f4bb92..83300995b0b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,7 +51,7 @@ public static class SelfReferencingObjectModelMapInput { } - public static class SelfReferencingObjectModel1 extends JsonSchema implements MapSchemaValidator { + public static class SelfReferencingObjectModel1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -63,7 +62,7 @@ public static class SelfReferencingObjectModel1 extends JsonSchema implements Ma protected SelfReferencingObjectModel1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("selfRef", SelfReferencingObjectModel1.class) )) @@ -78,25 +77,10 @@ public static SelfReferencingObjectModel1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SelfReferencingObjectModelMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SelfReferencingObjectModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -112,7 +96,7 @@ public SelfReferencingObjectModelMap getNewInstance(FrozenMap arg, List< public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -122,9 +106,8 @@ public SelfReferencingObjectModelMap validate(Map arg, SchemaCon @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java index d8d72293ab0..5efde520ef7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java @@ -31,7 +31,7 @@ public class Shape { // nest classes so all schemas and input/output classes can be public - public static class Shape1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Shape1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -55,15 +55,6 @@ public static Shape1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -74,18 +65,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -97,18 +78,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -120,8 +91,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -140,16 +111,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -159,8 +120,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -176,46 +137,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -223,7 +184,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -242,12 +203,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java index 9d2df0e827d..699313e0aaa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java @@ -35,7 +35,7 @@ public class ShapeOrNull { public static class Schema0 extends NullJsonSchema {} - public static class ShapeOrNull1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class ShapeOrNull1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -62,15 +62,6 @@ public static ShapeOrNull1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -81,18 +72,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -104,18 +85,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -127,8 +98,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -147,16 +118,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -166,8 +127,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -183,46 +144,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -230,7 +191,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -249,12 +210,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java index 1498573694c..7fed4699525 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java @@ -54,16 +54,6 @@ public static QuadrilateralType getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -71,8 +61,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -113,12 +103,12 @@ public static class Schema1MapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("quadrilateralType", QuadrilateralType.class) )) @@ -132,25 +122,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -166,7 +141,7 @@ public Schema1Map getNewInstance(FrozenMap arg, List pathToItem, public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -176,16 +151,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class SimpleQuadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class SimpleQuadrilateral1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -209,15 +183,6 @@ public static SimpleQuadrilateral1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -228,18 +193,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -251,18 +206,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -274,8 +219,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -294,16 +239,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -313,8 +248,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -330,46 +265,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -377,7 +312,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -396,12 +331,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java index a527b397e1f..533efccfbfe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java @@ -31,7 +31,7 @@ public class SomeObject { // nest classes so all schemas and input/output classes can be public - public static class SomeObject1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class SomeObject1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -54,15 +54,6 @@ public static SomeObject1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -73,18 +64,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -96,18 +77,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -119,8 +90,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -139,16 +110,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -158,8 +119,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -175,46 +136,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -222,7 +183,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -241,12 +202,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java index 056172d0211..054fb3dcbe3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java @@ -56,7 +56,7 @@ public static class SpecialModelnameMapInput { } - public static class SpecialModelname1 extends JsonSchema implements MapSchemaValidator { + public static class SpecialModelname1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -69,7 +69,7 @@ model with an invalid class name for python protected SpecialModelname1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("a", A.class) )) @@ -83,25 +83,10 @@ public static SpecialModelname1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SpecialModelnameMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SpecialModelnameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -117,7 +102,7 @@ public SpecialModelnameMap getNewInstance(FrozenMap arg, List pa public SpecialModelnameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -127,9 +112,8 @@ public SpecialModelnameMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java index e017f1ec148..d90164964ed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -47,7 +46,7 @@ public static class StringBooleanMapMapInput { } - public static class StringBooleanMap1 extends JsonSchema implements MapSchemaValidator { + public static class StringBooleanMap1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -58,7 +57,7 @@ public static class StringBooleanMap1 extends JsonSchema implements MapSchemaVal protected StringBooleanMap1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties.class) ); } @@ -70,28 +69,13 @@ public static StringBooleanMap1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Boolean val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Boolean fixedVal = (Boolean) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public StringBooleanMapMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public StringBooleanMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Boolean value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Boolean castValue = (Boolean) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -104,7 +88,7 @@ public StringBooleanMapMap getNewInstance(FrozenMap arg, List p public StringBooleanMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -114,9 +98,8 @@ public StringBooleanMapMap validate(Map arg, SchemaConfiguratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java index 02976fb6f2b..981b9739402 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java @@ -59,16 +59,6 @@ public static StringEnum1 getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -76,18 +66,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -97,8 +77,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java index e9234baec10..1e4da5f9aed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java @@ -51,16 +51,6 @@ public static StringEnumWithDefaultValue1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,8 +58,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java index 0548b05a2c4..1bb39d93524 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java @@ -46,16 +46,6 @@ public static StringWithValidation1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,8 +53,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java index 9f48a7bb449..4194c0604bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java @@ -67,7 +67,7 @@ public static class TagMapInput { } - public static class Tag1 extends JsonSchema implements MapSchemaValidator { + public static class Tag1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -78,7 +78,7 @@ public static class Tag1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public TagMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public TagMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -127,7 +112,7 @@ public TagMap getNewInstance(FrozenMap arg, List pathToItem, Pat public TagMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -137,9 +122,8 @@ public TagMap validate(Map arg, SchemaConfiguration configuratio @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java index 1a5f85cc00d..c8a27a34e26 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java @@ -31,7 +31,7 @@ public class Triangle { // nest classes so all schemas and input/output classes can be public - public static class Triangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Triangle1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -56,15 +56,6 @@ public static Triangle1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -75,18 +66,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -98,18 +79,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -121,8 +92,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -141,16 +112,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -160,8 +121,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -177,46 +138,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -224,7 +185,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -243,12 +204,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java index dd2f9138071..7a0f68b9238 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java @@ -55,16 +55,6 @@ public static ShapeType getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -72,8 +62,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -120,7 +110,7 @@ public static class TriangleInterfaceMapInput { } - public static class TriangleInterface1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { + public static class TriangleInterface1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -148,15 +138,6 @@ public static TriangleInterface1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -167,18 +148,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -190,18 +161,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -213,8 +174,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -233,16 +194,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -252,8 +203,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -269,53 +220,42 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - @Override - public TriangleInterfaceMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public TriangleInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Object value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); - Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); } FrozenMap castProperties = new FrozenMap<>(properties); @@ -327,7 +267,7 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguratio Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -346,12 +286,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java index c0ec60ad444..0134a58d1b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java @@ -48,16 +48,6 @@ public static UUIDString1 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -65,8 +55,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java index 7ad78dbb792..232df2ce05b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java @@ -65,14 +65,14 @@ public static class UserStatus extends Int32JsonSchema {} public static class ObjectWithNoDeclaredProps extends MapJsonSchema {} - public static class ObjectWithNoDeclaredPropsNullable extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { + public static class ObjectWithNoDeclaredPropsNullable extends JsonSchema implements NullSchemaValidator, MapSchemaValidator> { private static ObjectWithNoDeclaredPropsNullable instance; protected ObjectWithNoDeclaredPropsNullable() { super(new JsonSchemaInfo() .type(Set.of( Void.class, - FrozenMap.class + Map.class )) ); } @@ -84,16 +84,6 @@ public static ObjectWithNoDeclaredPropsNullable getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -101,35 +91,30 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -141,9 +126,8 @@ public FrozenMap validate(Map arg, SchemaConfiguration c public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -155,7 +139,7 @@ public static class AnyTypeProp extends AnyTypeJsonSchema {} public static class Not extends NullJsonSchema {} - public static class AnyTypeExceptNullProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class AnyTypeExceptNullProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static AnyTypeExceptNullProp instance; protected AnyTypeExceptNullProp() { @@ -170,15 +154,6 @@ public static AnyTypeExceptNullProp getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -189,18 +164,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -212,18 +177,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -235,8 +190,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -255,16 +210,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -274,8 +219,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -291,46 +236,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -338,7 +283,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -357,12 +302,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -484,7 +427,7 @@ public static class UserMapInput { } - public static class User1 extends JsonSchema implements MapSchemaValidator { + public static class User1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -495,7 +438,7 @@ public static class User1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public UserMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public UserMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -555,7 +483,7 @@ public UserMap getNewInstance(FrozenMap arg, List pathToItem, Pa public UserMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -565,9 +493,8 @@ public UserMap validate(Map arg, SchemaConfiguration configurati @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java index 2a9afdf8310..deecc50c6e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java @@ -53,16 +53,6 @@ public static ClassName getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -70,8 +60,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -125,7 +115,7 @@ public static class WhaleMapInput { } - public static class Whale1 extends JsonSchema implements MapSchemaValidator { + public static class Whale1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -136,7 +126,7 @@ public static class Whale1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public WhaleMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -189,7 +164,7 @@ public WhaleMap getNewInstance(FrozenMap arg, List pathToItem, P public WhaleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -199,9 +174,8 @@ public WhaleMap validate(Map arg, SchemaConfiguration configurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java index e279393d1da..92c19ff7be6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.SetMaker; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -53,16 +52,6 @@ public static Type getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -70,8 +59,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -104,16 +93,6 @@ public static ClassName getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -121,8 +100,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -168,7 +147,7 @@ public static class ZebraMapInput { } - public static class Zebra1 extends JsonSchema implements MapSchemaValidator { + public static class Zebra1 extends JsonSchema implements MapSchemaValidator { /* NOTE: This class is auto generated by OpenAPI JSON Schema Generator. Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator @@ -179,7 +158,7 @@ public static class Zebra1 extends JsonSchema implements MapSchemaValidator castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public ZebraMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -232,7 +196,7 @@ public ZebraMap getNewInstance(FrozenMap arg, List pathToItem, P public ZebraMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -242,9 +206,8 @@ public ZebraMap validate(Map arg, SchemaConfiguration configurat @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java index c9ad9bf792f..aacb1e9c564 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,12 +53,12 @@ public static class HeaderParametersMapInput { } - public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { + public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { private static HeaderParameters1 instance; protected HeaderParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someHeader", Schema0.Schema01.class) )) @@ -74,28 +73,13 @@ public static HeaderParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeaderParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -108,7 +92,7 @@ public HeaderParametersMap getNewInstance(FrozenMap arg, List pa public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -118,9 +102,8 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java index 55d7c2b045b..01d61b1c691 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1.Schema1; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("subDir", Schema1.Schema11.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java index acb23a512c5..8e2e4422005 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java @@ -44,16 +44,6 @@ public static Schema11 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -61,8 +51,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java index 667f47a3e49..15bf5fbb3d2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.parameter0.PathParamSchema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("subDir", PathParamSchema0.PathParamSchema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java index b476375f207..e8d7e4bcecd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,12 +53,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("searchStr", Schema0.Schema01.class) )) @@ -74,28 +73,13 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -108,7 +92,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -118,9 +102,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/parameter0/PathParamSchema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/parameter0/PathParamSchema0.java index 1955e09ed8d..5a2eb9400e7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/parameter0/PathParamSchema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/parameter0/PathParamSchema0.java @@ -44,16 +44,6 @@ public static PathParamSchema01 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -61,8 +51,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java index e89e5207b62..971e50e3fee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,12 +53,12 @@ public static class HeaderParametersMapInput { } - public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { + public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { private static HeaderParameters1 instance; protected HeaderParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someHeader", Schema0.Schema01.class) )) @@ -74,28 +73,13 @@ public static HeaderParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeaderParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -108,7 +92,7 @@ public HeaderParametersMap getNewInstance(FrozenMap arg, List pa public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -118,9 +102,8 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java index 52ef55275b9..0e89f2f99b6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.parameter0.PathParamSchema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("subDir", PathParamSchema0.PathParamSchema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java index 9bbc9e2ca1e..3b68a883c18 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter4.Schema4; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -61,12 +60,12 @@ public static class HeaderParametersMapInput { } - public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { + public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { private static HeaderParameters1 instance; protected HeaderParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("required_boolean_group", Schema1.Schema11.class), new PropertyEntry("boolean_group", Schema4.Schema41.class) @@ -85,25 +84,10 @@ public static HeaderParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeaderParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -119,7 +103,7 @@ public HeaderParametersMap getNewInstance(FrozenMap arg, List pa public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -129,9 +113,8 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java index 567c981497a..1c493185cd9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java @@ -17,7 +17,6 @@ import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter5.Schema5; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -75,12 +74,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("required_string_group", Schema0.Schema01.class), new PropertyEntry("int64_group", Schema5.Schema51.class), @@ -102,25 +101,10 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -136,7 +120,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -146,9 +130,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java index 88515f50088..cd6e0e97ba4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java @@ -44,16 +44,6 @@ public static Schema11 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -61,8 +51,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java index 667bbe68ce7..68c9ff15cab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java @@ -44,16 +44,6 @@ public static Schema41 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -61,8 +51,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java index 29d2ee3ebcd..743fd689884 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.paths.fake.get.parameters.parameter1.Schema1; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -62,12 +61,12 @@ public static class HeaderParametersMapInput { } - public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { + public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { private static HeaderParameters1 instance; protected HeaderParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("enum_header_string", Schema1.Schema11.class), new PropertyEntry("enum_header_string_array", Schema0.Schema01.class) @@ -83,25 +82,10 @@ public static HeaderParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeaderParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -117,7 +101,7 @@ public HeaderParametersMap getNewInstance(FrozenMap arg, List pa public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -127,9 +111,8 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java index acb15b67bf0..2e641e43d42 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java @@ -17,7 +17,6 @@ import org.openapijsonschematools.client.paths.fake.get.parameters.parameter5.Schema5; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -78,12 +77,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("enum_query_double", Schema5.Schema51.class), new PropertyEntry("enum_query_string", Schema3.Schema31.class), @@ -101,25 +100,10 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -135,7 +119,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -145,9 +129,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java index 223b4f305e3..446b1d39b2a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java @@ -46,16 +46,6 @@ public static Items0 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,8 +53,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -90,12 +80,12 @@ public static class SchemaListInput0 { } - public static class Schema01 extends JsonSchema implements ListSchemaValidator { + public static class Schema01 extends JsonSchema implements ListSchemaValidator { private static Schema01 instance; protected Schema01() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items0.class) ); } @@ -108,29 +98,14 @@ public static Schema01 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList0 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -142,7 +117,7 @@ public SchemaList0 getNewInstance(FrozenList arg, List pathToIte public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -151,9 +126,8 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java index ea726bf44a2..67a2e55ed57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java @@ -45,16 +45,6 @@ public static Schema11 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -62,8 +52,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java index 3029fc33ebe..1ae98c68f66 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java @@ -46,16 +46,6 @@ public static Items2 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -63,8 +53,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -90,12 +80,12 @@ public static class SchemaListInput2 { } - public static class Schema21 extends JsonSchema implements ListSchemaValidator { + public static class Schema21 extends JsonSchema implements ListSchemaValidator { private static Schema21 instance; protected Schema21() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items2.class) ); } @@ -108,29 +98,14 @@ public static Schema21 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList2 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -142,7 +117,7 @@ public SchemaList2 getNewInstance(FrozenList arg, List pathToIte public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -151,9 +126,8 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java index afbe4d72c5e..e5f3967a057 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java @@ -45,16 +45,6 @@ public static Schema31 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -62,8 +52,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java index 84a87e3337c..f9f610bb92b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java @@ -48,16 +48,6 @@ public static Schema41 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -65,8 +55,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java index 26e6445648e..3308083b080 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java @@ -48,16 +48,6 @@ public static Schema51 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -66,7 +56,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/Schema.java index 2a6a6466f2d..0e393962e1c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/Schema.java @@ -49,16 +49,6 @@ public static Items getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -66,8 +56,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -93,12 +83,12 @@ public static class EnumFormStringArrayListInput { } - public static class EnumFormStringArray extends JsonSchema implements ListSchemaValidator { + public static class EnumFormStringArray extends JsonSchema implements ListSchemaValidator { private static EnumFormStringArray instance; protected EnumFormStringArray() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -111,29 +101,14 @@ public static EnumFormStringArray getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public EnumFormStringArrayList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public EnumFormStringArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -145,7 +120,7 @@ public EnumFormStringArrayList getNewInstance(FrozenList arg, List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -154,9 +129,8 @@ public EnumFormStringArrayList validate(List arg, SchemaConfiguration co @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -185,16 +159,6 @@ public static EnumFormString getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -202,8 +166,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -251,12 +215,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("enum_form_string_array", EnumFormStringArray.class), new PropertyEntry("enum_form_string", EnumFormString.class) @@ -271,25 +235,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -305,7 +254,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -315,9 +264,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/Schema.java index addac30cf88..270fda1019c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/Schema.java @@ -53,16 +53,6 @@ public static IntegerSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -70,8 +60,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -123,16 +113,6 @@ public static Int32 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -140,8 +120,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { @@ -187,16 +167,6 @@ public static NumberSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -205,7 +175,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); @@ -255,16 +225,6 @@ public static FloatSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -273,7 +233,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); @@ -312,16 +272,6 @@ public static DoubleSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -330,7 +280,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + return castArg; } public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); @@ -367,16 +317,6 @@ public static StringSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -384,8 +324,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -418,16 +358,6 @@ public static PatternWithoutDelimiter getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -435,8 +365,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -478,16 +408,6 @@ public static DateTime getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -495,8 +415,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -529,16 +449,6 @@ public static Password getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -546,8 +456,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -645,12 +555,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("integer", IntegerSchema.class), new PropertyEntry("int32", Int32.class), @@ -683,25 +593,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -717,7 +612,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -727,9 +622,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java index 852bc3a37be..037fbd084fd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("query", Schema0.Schema01.class) )) @@ -75,28 +74,13 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java index 4911db49743..2d0041a3222 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java @@ -16,7 +16,6 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter2.Schema2; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -64,12 +63,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someVar", Schema0.Schema01.class), new PropertyEntry("some_var", Schema2.Schema21.class), @@ -91,25 +90,10 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -125,7 +109,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -135,9 +119,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java index 22de3bad990..0fd5c7282c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("id", Schema0.Schema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/Schema.java index 0ccc795dfbd..ae2e1cb0c3a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/Schema.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -47,12 +46,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(AdditionalProperties.class) ); } @@ -64,28 +63,13 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -98,7 +82,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -108,9 +92,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java index f62886ea7f6..5a8ac011488 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter1.Schema1; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -62,12 +61,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("compositionAtRoot", Schema0.Schema01.class), new PropertyEntry("compositionInProperty", Schema1.Schema11.class) @@ -83,25 +82,10 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -117,7 +101,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -127,9 +111,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java index fa06f17a596..bd5bb22cf4c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java @@ -50,16 +50,6 @@ public static Schema00 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,8 +57,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -80,7 +70,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Schema01 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema01 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema01 instance; protected Schema01() { @@ -97,15 +87,6 @@ public static Schema01 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -116,18 +97,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -139,18 +110,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -162,8 +123,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -182,16 +143,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -201,8 +152,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -218,46 +169,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -265,7 +216,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -284,12 +235,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java index 5c01cfc2ce2..641571eb398 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java @@ -51,16 +51,6 @@ public static Schema01 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,8 +58,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -81,7 +71,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class SomeProp1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class SomeProp1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static SomeProp1 instance; protected SomeProp1() { @@ -98,15 +88,6 @@ public static SomeProp1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -117,18 +98,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -140,18 +111,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -163,8 +124,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -183,16 +144,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -202,8 +153,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -219,46 +170,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -266,7 +217,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -285,12 +236,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -325,12 +274,12 @@ public static class SchemaMapInput1 { } - public static class Schema11 extends JsonSchema implements MapSchemaValidator { + public static class Schema11 extends JsonSchema implements MapSchemaValidator { private static Schema11 instance; protected Schema11() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someProp", SomeProp1.class) )) @@ -344,25 +293,10 @@ public static Schema11 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap1 getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -378,7 +312,7 @@ public SchemaMap1 getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -388,9 +322,8 @@ public SchemaMap1 validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/Schema.java index f2cebc6efe2..7bea3fa408f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/Schema.java @@ -50,16 +50,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,8 +57,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -80,7 +70,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema1 instance; protected Schema1() { @@ -97,15 +87,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -116,18 +97,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -139,18 +110,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -162,8 +123,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -182,16 +143,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -201,8 +152,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -218,46 +169,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -265,7 +216,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -284,12 +235,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/Schema.java index 298ef481a30..1f1e6987d9b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/Schema.java @@ -51,16 +51,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,8 +58,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -81,7 +71,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class SomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class SomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static SomeProp instance; protected SomeProp() { @@ -98,15 +88,6 @@ public static SomeProp getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -117,18 +98,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -140,18 +111,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -163,8 +124,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -183,16 +144,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -202,8 +153,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -219,46 +170,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -266,7 +217,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -285,12 +236,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -325,12 +274,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someProp", SomeProp.class) )) @@ -344,25 +293,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -378,7 +312,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -388,9 +322,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/response200/content/applicationjson/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/response200/content/applicationjson/Schema.java index c2bde4a1fc4..c3a878072e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/response200/content/applicationjson/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/response200/content/applicationjson/Schema.java @@ -50,16 +50,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -67,8 +57,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -80,7 +70,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class Schema1 extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static Schema1 instance; protected Schema1() { @@ -97,15 +87,6 @@ public static Schema1 getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -116,18 +97,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -139,18 +110,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -162,8 +123,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -182,16 +143,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -201,8 +152,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -218,46 +169,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -265,7 +216,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -284,12 +235,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/response200/content/multipartformdata/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/response200/content/multipartformdata/Schema.java index 917fec9a670..05cec09b74b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/response200/content/multipartformdata/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/response200/content/multipartformdata/Schema.java @@ -51,16 +51,6 @@ public static Schema0 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -68,8 +58,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -81,7 +71,7 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class SomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { + public static class SomeProp extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static SomeProp instance; protected SomeProp() { @@ -98,15 +88,6 @@ public static SomeProp getInstance() { } return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -117,18 +98,8 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -140,18 +111,8 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); - } - - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -163,8 +124,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) { @@ -183,16 +144,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -202,8 +153,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { @@ -219,46 +170,46 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = (Object) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + FrozenList newInstanceItems = new FrozenList<>(items); + return newInstanceItems; } @Override - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); - List pathToItem = new ArrayList<>(); - pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = List.of("args[0"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = (Object) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + FrozenMap castProperties = new FrozenMap<>(properties); + return castProperties; } @Override @@ -266,7 +217,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -285,12 +236,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -325,12 +274,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someProp", SomeProp.class) )) @@ -344,25 +293,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -378,7 +312,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -388,9 +322,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/Schema.java index a959abfdf17..f97d28612b6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/Schema.java @@ -62,12 +62,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("param", Param.class), new PropertyEntry("param2", Param2.class) @@ -86,25 +86,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -120,7 +105,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -130,9 +115,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/Schema.java index 106e72214c4..d29746178d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/Schema.java @@ -56,12 +56,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("a", A.class) )) @@ -75,25 +75,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -109,7 +94,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +104,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/Schema.java index 8385ad47615..0d82f864554 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/Schema.java @@ -56,12 +56,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("b", B.class) )) @@ -75,25 +75,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -109,7 +94,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +104,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java index eaa0a70332f..cebe9113378 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,12 +53,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator, FrozenMap, QueryParametersMap> { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator, QueryParametersMap> { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("mapBean", Schema0.Schema01.class) )) @@ -74,28 +73,13 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - Map val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenMap value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Schema0.SchemaMap0 castValue = (Schema0.SchemaMap0) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -108,7 +92,7 @@ public QueryParametersMap getNewInstance(FrozenMap> arg, List< public QueryParametersMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -118,9 +102,8 @@ public QueryParametersMap validate(Map> arg, SchemaC @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java index f8a51e6f7e1..281969bb0db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java @@ -56,12 +56,12 @@ public static class SchemaMapInput0 { } - public static class Schema01 extends JsonSchema implements MapSchemaValidator { + public static class Schema01 extends JsonSchema implements MapSchemaValidator { private static Schema01 instance; protected Schema01() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("keyword", Keyword0.class) )) @@ -75,25 +75,10 @@ public static Schema01 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap0 getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -109,7 +94,7 @@ public SchemaMap0 getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +104,8 @@ public SchemaMap0 validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java index 7b9d81fabd5..5ea68fe7cca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java @@ -18,7 +18,6 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter18.Schema18; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -74,12 +73,12 @@ public static class CookieParametersMapInput { } - public static class CookieParameters1 extends JsonSchema implements MapSchemaValidator { + public static class CookieParameters1 extends JsonSchema implements MapSchemaValidator { private static CookieParameters1 instance; protected CookieParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("1", Schema14.Schema141.class), new PropertyEntry("aB", Schema15.Schema151.class), @@ -98,25 +97,10 @@ public static CookieParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public CookieParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public CookieParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -132,7 +116,7 @@ public CookieParametersMap getNewInstance(FrozenMap arg, List pa public CookieParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -142,9 +126,8 @@ public CookieParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java index 7177441c1a3..fa09534ce2a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java @@ -17,7 +17,6 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter8.Schema8; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -66,12 +65,12 @@ public static class HeaderParametersMapInput { } - public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { + public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { private static HeaderParameters1 instance; protected HeaderParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("1", Schema5.Schema51.class), new PropertyEntry("aB", Schema6.Schema61.class), @@ -89,25 +88,10 @@ public static HeaderParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeaderParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -123,7 +107,7 @@ public HeaderParametersMap getNewInstance(FrozenMap arg, List pa public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -133,9 +117,8 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java index ff9e2bf6d00..3d66af1d8a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java @@ -18,7 +18,6 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter9.Schema9; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -68,12 +67,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("1", Schema9.Schema91.class), new PropertyEntry("aB", Schema10.Schema101.class), @@ -99,25 +98,10 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -133,7 +117,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -143,9 +127,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java index 52e8b17203b..12984649aab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java @@ -18,7 +18,6 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter4.Schema4; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -74,12 +73,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("1", Schema0.Schema01.class), new PropertyEntry("aB", Schema1.Schema11.class), @@ -98,25 +97,10 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -132,7 +116,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -142,9 +126,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java index 65e53cded73..cb08f998e5c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("petId", Schema0.Schema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Long val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Long fixedVal = (Long) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Long value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Long castValue = (Long) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List pathTo public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.java index e73fde575d0..d1fc97860c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.java @@ -67,12 +67,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("additionalMetadata", AdditionalMetadata.class), new PropertyEntry("requiredFile", RequiredFile.class) @@ -90,25 +90,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -124,7 +109,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -134,9 +119,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java index 2d0ce44c155..d9163f0b843 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someParam", Schema0.Schema01.class) )) @@ -75,25 +74,10 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -109,7 +93,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java index f31902c7c45..25070b2b811 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,12 +53,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator, FrozenMap, QueryParametersMap> { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator, QueryParametersMap> { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("mapBean", Foo.Foo1.class) )) @@ -74,28 +73,13 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - Map val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenMap fixedVal = (FrozenMap) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenMap value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Foo.FooMap castValue = (Foo.FooMap) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -108,7 +92,7 @@ public QueryParametersMap getNewInstance(FrozenMap> arg, List< public QueryParametersMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -118,9 +102,8 @@ public QueryParametersMap validate(Map> arg, SchemaC @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java index a90196305bd..9b6c3848685 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java @@ -19,7 +19,6 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter4.Schema4; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -82,12 +81,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("refParam", StringWithValidation.StringWithValidation1.class), new PropertyEntry("ioutil", Schema1.Schema11.class), @@ -115,25 +114,10 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -149,7 +133,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -159,9 +143,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java index 3325718bc1f..fa3faef1331 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java @@ -40,12 +40,12 @@ public static class SchemaListInput0 { } - public static class Schema01 extends JsonSchema implements ListSchemaValidator { + public static class Schema01 extends JsonSchema implements ListSchemaValidator { private static Schema01 instance; protected Schema01() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items0.class) ); } @@ -58,29 +58,14 @@ public static Schema01 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList0 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -92,7 +77,7 @@ public SchemaList0 getNewInstance(FrozenList arg, List pathToIte public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -101,9 +86,8 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java index c3791474c25..fb4902d728d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java @@ -40,12 +40,12 @@ public static class SchemaListInput1 { } - public static class Schema11 extends JsonSchema implements ListSchemaValidator { + public static class Schema11 extends JsonSchema implements ListSchemaValidator { private static Schema11 instance; protected Schema11() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items1.class) ); } @@ -58,29 +58,14 @@ public static Schema11 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList1 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -92,7 +77,7 @@ public SchemaList1 getNewInstance(FrozenList arg, List pathToIte public SchemaList1 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -101,9 +86,8 @@ public SchemaList1 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java index 6732612cdca..957e4016413 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java @@ -40,12 +40,12 @@ public static class SchemaListInput2 { } - public static class Schema21 extends JsonSchema implements ListSchemaValidator { + public static class Schema21 extends JsonSchema implements ListSchemaValidator { private static Schema21 instance; protected Schema21() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items2.class) ); } @@ -58,29 +58,14 @@ public static Schema21 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList2 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -92,7 +77,7 @@ public SchemaList2 getNewInstance(FrozenList arg, List pathToIte public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -101,9 +86,8 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java index 61275211156..955ef3992de 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java @@ -40,12 +40,12 @@ public static class SchemaListInput3 { } - public static class Schema31 extends JsonSchema implements ListSchemaValidator { + public static class Schema31 extends JsonSchema implements ListSchemaValidator { private static Schema31 instance; protected Schema31() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items3.class) ); } @@ -58,29 +58,14 @@ public static Schema31 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList3 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -92,7 +77,7 @@ public SchemaList3 getNewInstance(FrozenList arg, List pathToIte public SchemaList3 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -101,9 +86,8 @@ public SchemaList3 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java index 3cf82b8583c..de9b164dd3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java @@ -40,12 +40,12 @@ public static class SchemaListInput4 { } - public static class Schema41 extends JsonSchema implements ListSchemaValidator { + public static class Schema41 extends JsonSchema implements ListSchemaValidator { private static Schema41 instance; protected Schema41() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items4.class) ); } @@ -58,29 +58,14 @@ public static Schema41 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList4 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -92,7 +77,7 @@ public SchemaList4 getNewInstance(FrozenList arg, List pathToIte public SchemaList4 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -101,9 +86,8 @@ public SchemaList4 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/Schema.java index f6e71fec283..ee2670ba604 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/Schema.java @@ -67,12 +67,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("additionalMetadata", AdditionalMetadata.class), new PropertyEntry("file", File.class) @@ -90,25 +90,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -124,7 +109,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -134,9 +119,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/Schema.java index 0291b26bc92..9bcd5350437 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/Schema.java @@ -45,12 +45,12 @@ public static class FilesListInput { } - public static class Files extends JsonSchema implements ListSchemaValidator { + public static class Files extends JsonSchema implements ListSchemaValidator { private static Files instance; protected Files() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items.class) ); } @@ -63,29 +63,14 @@ public static Files getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public FilesList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public FilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -97,7 +82,7 @@ public FilesList getNewInstance(FrozenList arg, List pathToItem, public FilesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -106,9 +91,8 @@ public FilesList validate(List arg, SchemaConfiguration configuration) t @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -143,12 +127,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("files", Files.class) )) @@ -162,25 +146,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -196,7 +165,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -206,9 +175,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/responsedefault/content/applicationjson/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/responsedefault/content/applicationjson/Schema.java index ba49b6e80d4..6fdc3d7d109 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/responsedefault/content/applicationjson/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/responsedefault/content/applicationjson/Schema.java @@ -47,12 +47,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("string", Foo.Foo1.class) )) @@ -66,25 +66,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -100,7 +85,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -110,9 +95,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java index 722e02b409f..673ade47cd2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -53,12 +52,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator, FrozenList, QueryParametersMap> { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator, QueryParametersMap> { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("status", Schema0.Schema01.class) )) @@ -76,28 +75,13 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - List val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenList fixedVal = (FrozenList) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenList value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Schema0.SchemaList0 castValue = (Schema0.SchemaList0) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -110,7 +94,7 @@ public QueryParametersMap getNewInstance(FrozenMap> arg, List public QueryParametersMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -120,9 +104,8 @@ public QueryParametersMap validate(Map> arg, SchemaConfigur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java index fb9d32bf10a..037156427d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java @@ -47,16 +47,6 @@ public static Items0 getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -64,8 +54,8 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val String castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } @Override @@ -91,12 +81,12 @@ public static class SchemaListInput0 { } - public static class Schema01 extends JsonSchema implements ListSchemaValidator { + public static class Schema01 extends JsonSchema implements ListSchemaValidator { private static Schema01 instance; protected Schema01() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items0.class) ); } @@ -109,29 +99,14 @@ public static Schema01 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList0 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -143,7 +118,7 @@ public SchemaList0 getNewInstance(FrozenList arg, List pathToIte public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -152,9 +127,8 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java index c7484a48905..610e00f346a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -53,12 +52,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator, FrozenList, QueryParametersMap> { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator, QueryParametersMap> { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("tags", Schema0.Schema01.class) )) @@ -76,28 +75,13 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap> castToAllowedTypes(Map> arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap> argFixed = new LinkedHashMap<>(); - for (Map.Entry> entry: arg.entrySet()) { - String key = entry.getKey(); - List val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - FrozenList fixedVal = (FrozenList) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap> arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry> entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - FrozenList value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Schema0.SchemaList0 castValue = (Schema0.SchemaList0) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -110,7 +94,7 @@ public QueryParametersMap getNewInstance(FrozenMap> arg, List public QueryParametersMap validate(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap> castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -120,9 +104,8 @@ public QueryParametersMap validate(Map> arg, SchemaConfigur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap> castArg = (FrozenMap>) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java index 2a330e8cc99..76b39b7403a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java @@ -40,12 +40,12 @@ public static class SchemaListInput0 { } - public static class Schema01 extends JsonSchema implements ListSchemaValidator { + public static class Schema01 extends JsonSchema implements ListSchemaValidator { private static Schema01 instance; protected Schema01() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(Items0.class) ); } @@ -58,29 +58,14 @@ public static Schema01 getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = (String) castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public SchemaList0 getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - ArrayList items = new ArrayList<>(); + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); - String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); items.add(castItem); i += 1; } @@ -92,7 +77,7 @@ public SchemaList0 getNewInstance(FrozenList arg, List pathToIte public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -101,9 +86,8 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java index da5d3f3493b..d48b5618a05 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -54,12 +53,12 @@ public static class HeaderParametersMapInput { } - public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { + public static class HeaderParameters1 extends JsonSchema implements MapSchemaValidator { private static HeaderParameters1 instance; protected HeaderParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("api_key", Schema0.Schema01.class) )) @@ -74,28 +73,13 @@ public static HeaderParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeaderParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -108,7 +92,7 @@ public HeaderParametersMap getNewInstance(FrozenMap arg, List pa public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -118,9 +102,8 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java index 707382e4786..5674693d26c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1.Schema1; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("petId", Schema1.Schema11.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Long val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Long fixedVal = (Long) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Long value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Long castValue = (Long) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List pathTo public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java index b104a5587f1..352c2a4672f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("petId", Schema0.Schema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Long val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Long fixedVal = (Long) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Long value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Long castValue = (Long) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List pathTo public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java index ba35a859796..0960a314273 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("petId", Schema0.Schema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Long val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Long fixedVal = (Long) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Long value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Long castValue = (Long) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List pathTo public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/Schema.java index 1e10b4333e3..af72044b38c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/Schema.java @@ -66,12 +66,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("name", Name.class), new PropertyEntry("status", Status.class) @@ -86,25 +86,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -120,7 +105,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -130,9 +115,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java index b015227ae0a..b66a920a2d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("petId", Schema0.Schema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Long val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Long fixedVal = (Long) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Long value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Long castValue = (Long) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List pathTo public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/Schema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/Schema.java index d31285847b5..f61e69006dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/Schema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/Schema.java @@ -68,12 +68,12 @@ public static class SchemaMapInput { } - public static class Schema1 extends JsonSchema implements MapSchemaValidator { + public static class Schema1 extends JsonSchema implements MapSchemaValidator { private static Schema1 instance; protected Schema1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("additionalMetadata", AdditionalMetadata.class), new PropertyEntry("file", File.class) @@ -88,25 +88,10 @@ public static Schema1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -122,7 +107,7 @@ public SchemaMap getNewInstance(FrozenMap arg, List pathToItem, public SchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -132,9 +117,8 @@ public SchemaMap validate(Map arg, SchemaConfiguration configura @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java index b69edf97f2c..725c3472b00 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("order_id", Schema0.Schema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java index 24aa8ac1ec6..b0462d9be1e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0.Schema0; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("order_id", Schema0.Schema01.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Long val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Long fixedVal = (Long) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - Long value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); Long castValue = (Long) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List pathTo public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration con @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java index ba300d271f6..8023828697d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java @@ -45,16 +45,6 @@ public static Schema01 getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); @@ -62,8 +52,8 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); - PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); - return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); + getPathToSchemas(this, castArg, validationMetadata, pathSet); + return castArg; } public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java index c88a9fb9fda..836f3c4a7c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter1.Schema1; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -58,12 +57,12 @@ public static class QueryParametersMapInput { } - public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { + public static class QueryParameters1 extends JsonSchema implements MapSchemaValidator { private static QueryParameters1 instance; protected QueryParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("password", Schema1.Schema11.class), new PropertyEntry("username", Schema0.Schema01.class) @@ -83,25 +82,10 @@ public static QueryParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public QueryParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -117,7 +101,7 @@ public QueryParametersMap getNewInstance(FrozenMap arg, List pat public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -127,9 +111,8 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/response200/Headers.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/response200/Headers.java index a24076b4392..f6c6a59ad27 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/response200/Headers.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/response200/Headers.java @@ -18,7 +18,6 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.response200.headers.xratelimit.content.applicationjson.XRateLimitSchema; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -67,12 +66,12 @@ public static class HeadersMapInput { } - public static class Headers1 extends JsonSchema implements MapSchemaValidator { + public static class Headers1 extends JsonSchema implements MapSchemaValidator { private static Headers1 instance; protected Headers1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("X-Rate-Limit", XRateLimitSchema.XRateLimitSchema1.class), new PropertyEntry("int32", Int32JsonContentTypeHeaderSchema.Int32JsonContentTypeHeaderSchema1.class), @@ -96,25 +95,10 @@ public static Headers1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = (Object) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public HeadersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeadersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); Object value = entry.getValue(); @@ -130,7 +114,7 @@ public HeadersMap getNewInstance(FrozenMap arg, List pathToItem, public HeadersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -140,9 +124,8 @@ public HeadersMap validate(Map arg, SchemaConfiguration configur @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java index 4401fc121e8..e995e2e718b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("username", Schema.Schema1.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java index 1d16203f1b1..134228e74f3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("username", Schema.Schema1.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java index e0d738c1d42..6a3838eb3c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema; -import org.openapijsonschematools.client.schemas.validation.AdditionalPropertiesValidator; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -52,12 +51,12 @@ public static class PathParametersMapInput { } - public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { + public static class PathParameters1 extends JsonSchema implements MapSchemaValidator { private static PathParameters1 instance; protected PathParameters1() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("username", Schema.Schema1.class) )) @@ -75,28 +74,13 @@ public static PathParameters1 getInstance() { return instance; } - @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = (String) castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); - } - - public PathParametersMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); - for(Map.Entry entry: arg.entrySet()) { - String propertyName = entry.getKey(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); List propertyPathToItem = new ArrayList<>(pathToItem); propertyPathToItem.add(propertyName); - String value = entry.getValue(); + Object value = entry.getValue(); JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); properties.put(propertyName, castValue); @@ -109,7 +93,7 @@ public PathParametersMap getNewInstance(FrozenMap arg, List path public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -119,9 +103,8 @@ public PathParametersMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index b134e61f6a5..994aa4d4998 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -19,6 +19,7 @@ import java.time.LocalDate; import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; @@ -28,7 +29,7 @@ import java.util.Objects; import java.util.UUID; -public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class AnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static AnyTypeJsonSchema instance; protected AnyTypeJsonSchema() { @@ -42,16 +43,6 @@ public static AnyTypeJsonSchema getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -65,16 +56,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -88,16 +69,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -127,16 +98,6 @@ public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -163,13 +124,18 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -177,7 +143,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -186,13 +152,18 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -200,7 +171,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -219,13 +190,11 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } -} +} \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index a3eb800e106..e550fed4598 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -36,11 +36,6 @@ public static BooleanJsonSchema getInstance() { return instance; } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - @Override public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index d3879c4aa7d..56882f6403b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -39,11 +39,6 @@ public static DateJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index a4156f324b1..8a2dcd8ba4b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -39,11 +39,6 @@ public static DateTimeJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index 8ab3588e1ec..a67ef350218 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -38,11 +38,6 @@ public static DecimalJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 3fc49c54e22..00afd29ae4c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -38,11 +38,6 @@ public static DoubleJsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 147a3493719..eb7da1dd8de 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -38,11 +38,6 @@ public static FloatJsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 0f3672b9e17..f5a2f1872d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -41,11 +41,6 @@ public static Int32JsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index 45d5cfebb7c..ad2cfee3c81 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -43,11 +43,6 @@ public static Int64JsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 2a1a379d671..70e26275d1c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -43,11 +43,6 @@ public static IntJsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index bbc51abd047..7d171a1937d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -6,27 +6,24 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.KeywordEntry; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.TypeValidator; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import java.util.ArrayList; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.LinkedHashSet; -import java.util.Map; import java.util.List; import java.util.Objects; import java.util.Set; -public class ListJsonSchema extends JsonSchema implements ListSchemaValidator> { +public class ListJsonSchema extends JsonSchema implements ListSchemaValidator> { private static ListJsonSchema instance; protected ListJsonSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) ); } @@ -38,31 +35,37 @@ public static ListJsonSchema getInstance() { } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); - List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List pathToItem = new ArrayList<>(); + pathToItem.add("args[0]"); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); - ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); + PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); + ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 0fbf5338dda..4c3aa27719a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -6,13 +6,12 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.KeywordEntry; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.schemas.validation.TypeValidator; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -21,12 +20,12 @@ import java.util.Objects; import java.util.Set; -public class MapJsonSchema extends JsonSchema implements MapSchemaValidator> { +public class MapJsonSchema extends JsonSchema implements MapSchemaValidator> { private static MapJsonSchema instance; protected MapJsonSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) ); } @@ -38,20 +37,25 @@ public static MapJsonSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -61,8 +65,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index 7aef3092b9a..81217f8c4cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -8,8 +8,6 @@ import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; -import org.openapijsonschematools.client.schemas.validation.KeywordEntry; -import org.openapijsonschematools.client.schemas.validation.NotValidator; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator; import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; @@ -19,16 +17,19 @@ import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.Set; import java.util.Map; -import java.util.LinkedHashMap; import java.util.Objects; +import java.util.UUID; -public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class NotAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static NotAnyTypeJsonSchema instance; protected NotAnyTypeJsonSchema() { @@ -44,14 +45,7 @@ public static NotAnyTypeJsonSchema getInstance() { return instance; } - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - + @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); @@ -64,16 +58,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -87,16 +71,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -110,14 +84,20 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); + public int validate(int arg, SchemaConfiguration configuration) { + return (int) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public long validate(long arg, SchemaConfiguration configuration) { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) { + return (double) validate((Number) arg, configuration); } @Override @@ -133,14 +113,31 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -148,7 +145,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -157,13 +154,18 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -171,7 +173,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -190,12 +192,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index d67842a88ed..2d6938a4b22 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -36,11 +36,6 @@ public static NullJsonSchema getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg,pathToItem, pathSet); - } - @Override public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index 747ef03f3c9..87a15430a93 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -41,11 +41,6 @@ public static NumberJsonSchema getInstance() { return instance; } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - @Override public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index c6df642418c..7c46f5ba114 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -39,11 +39,6 @@ public static StringJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index 506704c7b47..48c8acacb80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -39,11 +39,6 @@ public static UuidJsonSchema getInstance() { return instance; } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); - } - @Override public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { return arg; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java index 5df6d43e44b..0a36c4527c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java @@ -8,7 +8,5 @@ import java.util.Set; public interface BooleanSchemaValidator { - boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet); - boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas); boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java index 1790d2408b2..ab3ff21cbe1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenList.java @@ -1,51 +1,30 @@ package org.openapijsonschematools.client.schemas.validation; +import java.util.AbstractList; import java.util.ArrayList; import java.util.Collection; +import java.util.List; -public class FrozenList extends ArrayList { +public class FrozenList extends AbstractList { /* A frozen List Once schema validation has been run, indexed access returns values of the correct type If values were mutable, the types in those methods would not agree with returned values */ + private final List list; public FrozenList(Collection m) { - super(m); + super(); + list = new ArrayList<>(m); } - public boolean add(E e) { - throw new UnsupportedOperationException(); + @Override + public E get(int index) { + return list.get(index); } - public void add(int index, E element) { - throw new UnsupportedOperationException(); - } - - public E remove(int index) { - throw new UnsupportedOperationException(); - } - - public boolean remove(Object o) { - throw new UnsupportedOperationException(); - } - - public void clear() { - throw new UnsupportedOperationException(); - } - - public boolean addAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean addAll(int index, Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException(); + @Override + public int size() { + return list.size(); } } + diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java index f70600de9f3..4851ae62d7a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FrozenMap.java @@ -3,20 +3,22 @@ import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import java.util.LinkedHashMap; +import java.util.AbstractMap; +import java.util.HashMap; import java.util.Map; import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.Function; -public class FrozenMap extends LinkedHashMap { +public class FrozenMap extends AbstractMap { /* A frozen Map Once schema validation has been run, written accessor methods return values of the correct type If values were mutable, the types in those methods would not agree with returned values */ + private final Map map; public FrozenMap(Map m) { - super(m); + + super(); + map = new HashMap<>(m); } protected void throwIfKeyNotPresent(String key) throws UnsetPropertyException { @@ -31,64 +33,9 @@ protected void throwIfKeyKnown(String key, Set requiredKeys, Set } } - public V put(String key, V value) { - throw new UnsupportedOperationException(); - } - public V remove(Object key) { - throw new UnsupportedOperationException(); - } - public void putAll(Map m) { - throw new UnsupportedOperationException(); - } - public void clear() { - throw new UnsupportedOperationException(); - } - - @Override - public void replaceAll(BiFunction function) { - throw new UnsupportedOperationException(); - } - - @Override - public V putIfAbsent(String key, V value) { - throw new UnsupportedOperationException(); - } - @Override - public boolean remove(Object key, Object value) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean replace(String key, V oldValue, V newValue) { - throw new UnsupportedOperationException(); - } - - @Override - public V replace(String key, V value) { - throw new UnsupportedOperationException(); - } - - @Override - public V computeIfAbsent(String key, Function mappingFunction) { - throw new UnsupportedOperationException(); - } - - @Override - public V computeIfPresent(String key, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); - } - - @Override - public V compute(String key, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); - } - - @Override - public V merge(String key, V value, - BiFunction remappingFunction) { - throw new UnsupportedOperationException(); + public Set> entrySet() { + return map.entrySet(); } } + diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index a5cfa192d62..87ee535a81b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -223,7 +223,6 @@ public static PathToSchemasMap validate( ValidationMetadata validationMetadata ) throws ValidationException { LinkedHashSet disabledKeywords = validationMetadata.configuration().disabledKeywordFlags().getKeywords(); - Object extra = null; PathToSchemasMap pathToSchemas = new PathToSchemasMap(); LinkedHashMap thisKeywordToValidator = jsonSchema.keywordToValidator; if (thisKeywordToValidator != null) { @@ -253,105 +252,102 @@ public static PathToSchemasMap validate( return pathToSchemas; } - protected String castToAllowedStringTypes(String arg, List pathToItem, Set> pathSet) { + protected String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Boolean castToAllowedBooleanTypes(Boolean arg, List pathToItem, Set> pathSet) { + protected Boolean castToAllowedTypes(Boolean arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Number castToAllowedNumberTypes(Number arg, List pathToItem, Set> pathSet) { + protected Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected Void castToAllowedVoidTypes(Void arg, List pathToItem, Set> pathSet) { + protected Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); return arg; } - protected FrozenList castToAllowedListTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List argFixed = new ArrayList<>(); int i =0; - for (Object item: ((List) arg).toArray()) { + for (Object item: arg) { List newPathToItem = new ArrayList<>(pathToItem); newPathToItem.add(i); Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); argFixed.add(fixedVal); i += 1; } - return new FrozenList<>(argFixed); + return argFixed; } - protected FrozenMap castToAllowedMapTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: ((Map) arg).entrySet()) { + for (Map.Entry entry: arg.entrySet()) { String key = (String) entry.getKey(); - Object val = entry.getValue(); + Object val = arg.get(entry.getKey()); List newPathToItem = new ArrayList<>(pathToItem); newPathToItem.add(key); Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); argFixed.put(key, fixedVal); } - return new FrozenMap<>(argFixed); + return argFixed; } protected Object castToAllowedObjectTypes(Object arg, List pathToItem, Set> pathSet) { if (arg == null) { - return castToAllowedVoidTypes((Void) arg, pathToItem, pathSet); + return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { - return castToAllowedStringTypes((String) arg, pathToItem, pathSet); + return castToAllowedTypes((String) arg, pathToItem, pathSet); } else if (arg instanceof Map) { pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: ((Map) arg).entrySet()) { - String key = (String) entry.getKey(); - Object val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - Object fixedVal = castToAllowedObjectTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); - } - return new FrozenMap<>(argFixed); + return castToAllowedTypes((Map) arg, pathToItem, pathSet); } else if (arg instanceof Boolean) { - return castToAllowedBooleanTypes((Boolean) arg, pathToItem, pathSet); + return castToAllowedTypes((Boolean) arg, pathToItem, pathSet); } else if (arg instanceof Integer) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Long) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Float) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof Double) { - return castToAllowedNumberTypes((Number) arg, pathToItem, pathSet); + return castToAllowedTypes((Number) arg, pathToItem, pathSet); } else if (arg instanceof List) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (Object item: ((List) arg).toArray()) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - Object fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); + return castToAllowedTypes((List) arg, pathToItem, pathSet); } else if (arg instanceof ZonedDateTime) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else if (arg instanceof LocalDate) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else if (arg instanceof UUID) { - return castToAllowedStringTypes(arg.toString(), pathToItem, pathSet); + return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else { Class argClass = arg.getClass(); throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); } } + public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + + public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { + return arg; + } + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, Object arg, ValidationMetadata validationMetadata, Set> pathSet) { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index 5da300d98da..5f0dd278333 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -7,8 +7,7 @@ import java.util.List; import java.util.Set; -public interface ListSchemaValidator { - FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet); - OutType getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas); +public interface ListSchemaValidator { + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 4c76d7040e9..ec1abf1b1ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -8,8 +8,7 @@ import java.util.Map; import java.util.Set; -public interface MapSchemaValidator { - FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet); - OutType getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas); +public interface MapSchemaValidator { + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index ca3d21ff136..fef38fe1670 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -8,7 +8,5 @@ import java.util.Set; public interface NullSchemaValidator { - Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet); - Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas); Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java index eaec6888a67..1a601b35abf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java @@ -8,7 +8,5 @@ import java.util.Set; public interface NumberSchemaValidator { - Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet); - Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas); Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java index 752804304c1..d897f9670d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java @@ -8,7 +8,5 @@ import java.util.Set; public interface StringSchemaValidator { - String castToAllowedTypes(String arg, List pathToItem, Set> pathSet); - String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas); String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java index c00e3049537..33d23b656fa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.exceptions.ValidationException; +import java.util.List; +import java.util.Map; import java.util.Set; public class TypeValidator implements KeywordValidator { @@ -21,6 +23,10 @@ public PathToSchemasMap validate(JsonSchema schema, Object arg, ValidationMetada Class argClass; if (arg == null) { argClass = Void.class; + } else if (arg instanceof List) { + argClass = List.class; + } else if (arg instanceof Map) { + argClass = Map.class; } else { argClass = arg.getClass(); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 5de5ccacd7e..2622abe53e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -5,6 +5,9 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; +import java.time.LocalDate; +import java.time.ZonedDateTime; +import java.util.LinkedHashMap; import java.util.List; import java.util.HashSet; import java.util.ArrayList; @@ -12,8 +15,9 @@ import java.util.Set; import java.util.Map; import java.util.Objects; +import java.util.UUID; -public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { +public class UnsetAnyTypeJsonSchema extends JsonSchema implements NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator>, MapSchemaValidator> { private static UnsetAnyTypeJsonSchema instance; protected UnsetAnyTypeJsonSchema() { @@ -27,16 +31,6 @@ public static UnsetAnyTypeJsonSchema getInstance() { return instance; } - @Override - public Void castToAllowedTypes(Void arg, List pathToItem, Set> pathSet) { - return castToAllowedVoidTypes(arg, pathToItem, pathSet); - } - - @Override - public Void getNewInstance(Void arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -50,16 +44,6 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public boolean castToAllowedTypes(boolean arg, List pathToItem, Set> pathSet) { - return castToAllowedBooleanTypes(arg, pathToItem, pathSet); - } - - @Override - public boolean getNewInstance(boolean arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -73,16 +57,6 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public Number castToAllowedTypes(Number arg, List pathToItem, Set> pathSet) { - return castToAllowedNumberTypes(arg, pathToItem, pathSet); - } - - @Override - public Number getNewInstance(Number arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; - } - @Override public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); @@ -96,14 +70,20 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public String castToAllowedTypes(String arg, List pathToItem, Set> pathSet) { - return castToAllowedStringTypes(arg, pathToItem, pathSet); + public int validate(int arg, SchemaConfiguration configuration) { + return (int) validate((Number) arg, configuration); } - @Override - public String getNewInstance(String arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public long validate(long arg, SchemaConfiguration configuration) { + return (long) validate((Number) arg, configuration); + } + + public float validate(float arg, SchemaConfiguration configuration) { + return (float) validate((Number) arg, configuration); + } + + public double validate(double arg, SchemaConfiguration configuration) { + return (double) validate((Number) arg, configuration); } @Override @@ -119,14 +99,31 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - return castToAllowedListTypes(arg, pathToItem, pathSet); + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); + } + + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + return validate(arg.toString(), configuration); } @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); + i += 1; + } + return new FrozenList<>(items); } @Override @@ -134,7 +131,7 @@ public FrozenList validate(List arg, SchemaConfiguration configu Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -143,13 +140,18 @@ public FrozenList validate(List arg, SchemaConfiguration configu } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override @@ -157,7 +159,7 @@ public FrozenMap validate(Map arg, SchemaConfiguration c Set> pathSet = new HashSet<>(); List pathToItem = new ArrayList<>(); pathToItem.add("args[0]"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); PathToSchemasMap validatedPathToSchemas = new PathToSchemasMap(); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, new LinkedHashSet<>()); @@ -176,12 +178,10 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); - } else if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + } else if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); + } else if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index d7dd5c3432e..138ddc6d9fb 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -29,39 +29,34 @@ public class ArrayTypeSchemaTest { new LinkedHashSet<>() ); - public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator> { + public static class ArrayWithItemsSchema extends JsonSchema implements ListSchemaValidator> { public ArrayWithItemsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(StringJsonSchema.class) ); } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); + public FrozenList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + List items = new ArrayList<>(); + int i = 0; + for (Object item: arg) { + List itemPathToItem = new ArrayList<>(pathToItem); + itemPathToItem.add(i); + JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); + String castItem = (String) itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); + items.add(castItem); i += 1; } - return new FrozenList<>(argFixed); - } - - @Override - public FrozenList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return new FrozenList<>(items); } @Override public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -70,9 +65,8 @@ public FrozenList validate(List arg, SchemaConfiguration configu @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } @@ -88,35 +82,20 @@ public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfigurat } } - public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { + public static class ArrayWithOutputClsSchema extends JsonSchema implements ListSchemaValidator { public ArrayWithOutputClsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenList.class)) + .type(Set.of(List.class)) .items(StringJsonSchema.class) ); } @Override - public FrozenList castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - List argFixed = new ArrayList<>(); - int i =0; - for (String item: arg) { - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(i); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(item, newPathToItem, pathSet); - argFixed.add(fixedVal); - i += 1; - } - return new FrozenList<>(argFixed); - } - - @Override - public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { ArrayList items = new ArrayList<>(); int i = 0; - for (String item: arg) { + for (Object item: arg) { List itemPathToItem = new ArrayList<>(pathToItem); itemPathToItem.add(i); JsonSchema itemSchema = pathToSchemas.get(itemPathToItem).entrySet().iterator().next().getKey(); @@ -132,7 +111,7 @@ public ArrayWithOutputClsSchemaList getNewInstance(FrozenList arg, List< public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenList castArg = castToAllowedTypes(arg, pathToItem, pathSet); + List castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -141,9 +120,8 @@ public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfigurati @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenList) { - @SuppressWarnings("unchecked") FrozenList castArg = (FrozenList) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof List) { + return getNewInstance((List) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index 8c647153b2d..ee187d99f40 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -33,11 +33,11 @@ public class ObjectTypeSchemaTest { new LinkedHashSet<>() ); - public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithPropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithPropsSchema instance; private ObjectWithPropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) @@ -53,20 +53,25 @@ public static ObjectWithPropsSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -75,19 +80,18 @@ public FrozenMap validate(Map arg, SchemaConfiguration c @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { - if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + if (arg instanceof Map) { + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } } - public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithAddpropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithAddpropsSchema instance; private ObjectWithAddpropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .additionalProperties(StringJsonSchema.class) ); } @@ -100,30 +104,25 @@ public static ObjectWithAddpropsSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - pathSet.add(pathToItem); - LinkedHashMap argFixed = new LinkedHashMap<>(); - for (Map.Entry entry: arg.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - List newPathToItem = new ArrayList<>(pathToItem); - newPathToItem.add(key); - String fixedVal = StringJsonSchema.getInstance().castToAllowedTypes(val, newPathToItem, pathSet); - argFixed.put(key, fixedVal); + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + String castValue = (String) propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); } - return new FrozenMap<>(argFixed); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -140,11 +139,11 @@ public Object getNewInstance(Object arg, List pathToItem, PathToSchemasM } } - public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator> { + public static class ObjectWithPropsAndAddpropsSchema extends JsonSchema implements MapSchemaValidator> { private static ObjectWithPropsAndAddpropsSchema instance; private ObjectWithPropsAndAddpropsSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) @@ -160,20 +159,25 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public FrozenMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return arg; + public FrozenMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new FrozenMap<>(properties); } @Override public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -201,11 +205,11 @@ public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaCo } - public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { + public static class ObjectWithOutputTypeSchema extends JsonSchema implements MapSchemaValidator { private static ObjectWithOutputTypeSchema instance; public ObjectWithOutputTypeSchema() { super(new JsonSchemaInfo() - .type(Set.of(FrozenMap.class)) + .type(Set.of(Map.class)) .properties(Map.ofEntries( new PropertyEntry("someString", StringJsonSchema.class) )) @@ -220,20 +224,25 @@ public static ObjectWithOutputTypeSchema getInstance() { } @Override - public FrozenMap castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { - return castToAllowedMapTypes(arg, pathToItem, pathSet); - } - - @Override - public ObjectWithOutputTypeSchemaMap getNewInstance(FrozenMap arg, List pathToItem, PathToSchemasMap pathToSchemas) { - return new ObjectWithOutputTypeSchemaMap(arg); + public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + LinkedHashMap properties = new LinkedHashMap<>(); + for(Map.Entry entry: arg.entrySet()) { + String propertyName = (String) entry.getKey(); + List propertyPathToItem = new ArrayList<>(pathToItem); + propertyPathToItem.add(propertyName); + Object value = entry.getValue(); + JsonSchema propertySchema = pathToSchemas.get(propertyPathToItem).entrySet().iterator().next().getKey(); + Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); + properties.put(propertyName, castValue); + } + return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } @Override public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); - FrozenMap castArg = castToAllowedTypes(arg, pathToItem, pathSet); + Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); SchemaConfiguration usedConfiguration = Objects.requireNonNullElseGet(configuration, () -> new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone())); ValidationMetadata validationMetadata = new ValidationMetadata(pathToItem, usedConfiguration, new PathToSchemasMap(), new LinkedHashSet<>()); PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); @@ -243,8 +252,7 @@ public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaCon @Override public Object getNewInstance(Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof FrozenMap) { - @SuppressWarnings("unchecked") FrozenMap castArg = (FrozenMap) arg; - return getNewInstance(castArg, pathToItem, pathToSchemas); + return getNewInstance((Map) arg, pathToItem, pathToSchemas); } throw new InvalidTypeException("Invalid input type="+arg.getClass()+". It can't be instantiated by this schema"); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 73b11d7c6a2..f66926cf23d 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -11,7 +11,6 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import java.util.Map; class SomeSchema extends JsonSchema { private static SomeSchema instance;