|
15 | 15 | import java.util.Map;
|
16 | 16 | import java.util.Objects;
|
17 | 17 | import java.util.Set;
|
| 18 | +import java.util.UUID; |
18 | 19 |
|
19 | 20 | public interface Schema extends SchemaValidator {
|
20 | 21 | private static Object castToAllowedTypes(Object arg, List<Object> pathToItem, PathToTypeMap pathToType) {
|
@@ -69,6 +70,9 @@ private static Object castToAllowedTypes(Object arg, List<Object> pathToItem, Pa
|
69 | 70 | } else if (arg instanceof LocalDate) {
|
70 | 71 | pathToType.put(pathToItem, String.class);
|
71 | 72 | return arg.toString();
|
| 73 | + } else if (arg instanceof UUID) { |
| 74 | + pathToType.put(pathToItem, String.class); |
| 75 | + return arg.toString(); |
72 | 76 | } else {
|
73 | 77 | Class<?> argClass = arg.getClass();
|
74 | 78 | throw new RuntimeException("Invalid type passed in got input="+arg+" type="+argClass);
|
@@ -197,6 +201,10 @@ static String validate(Class<?> cls, LocalDate arg, SchemaConfiguration configur
|
197 | 201 | return (String) validateObject(cls, arg, configuration);
|
198 | 202 | }
|
199 | 203 |
|
| 204 | + static String validate(Class<?> cls, UUID arg, SchemaConfiguration configuration) { |
| 205 | + return (String) validateObject(cls, arg, configuration); |
| 206 | + } |
| 207 | + |
200 | 208 | static <T extends FrozenMap> T validate(Class<?> cls, Map<String, Object> arg, SchemaConfiguration configuration) {
|
201 | 209 | return (T) validateObject(cls, arg, configuration);
|
202 | 210 | }
|
|
0 commit comments