From 58ced3277142167d868495039bf07bf99f76db98 Mon Sep 17 00:00:00 2001 From: Christoph Kappestein Date: Sat, 30 Nov 2024 10:27:27 +0100 Subject: [PATCH] update tests --- tests/level_1_format.json | 28 +++++++++++ tests/level_2_array_inline_reference.json | 4 +- tests/level_2_array_reference.json | 8 ++-- tests/level_2_array_string.json | 4 +- tests/level_2_map_inline_reference.json | 4 +- tests/level_2_map_reference.json | 8 ++-- tests/level_2_map_string.json | 4 +- tests/level_4_generic.json | 3 +- tests/level_5_discriminator.json | 10 ++-- tests/sdkgen.json | 57 +++++++++++++++++++++++ 10 files changed, 108 insertions(+), 22 deletions(-) create mode 100644 tests/level_1_format.json create mode 100644 tests/sdkgen.json diff --git a/tests/level_1_format.json b/tests/level_1_format.json new file mode 100644 index 0000000..75184be --- /dev/null +++ b/tests/level_1_format.json @@ -0,0 +1,28 @@ +{ + "definitions": { + "Student": { + "type": "struct", + "properties": { + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "date": { + "type": "string", + "format": "date" + }, + "dateTime": { + "type": "string", + "format": "date-time" + }, + "time": { + "type": "string", + "format": "time" + } + } + } + }, + "root": "Student" +} \ No newline at end of file diff --git a/tests/level_2_array_inline_reference.json b/tests/level_2_array_inline_reference.json index 1e9ea66..6ccee38 100644 --- a/tests/level_2_array_inline_reference.json +++ b/tests/level_2_array_inline_reference.json @@ -16,12 +16,12 @@ "type": "array", "schema": { "type": "reference", - "target": "Student_Property" + "target": "StudentProperty" } } } }, - "Student_Property": { + "StudentProperty": { "type": "struct", "properties": { "name": { diff --git a/tests/level_2_array_reference.json b/tests/level_2_array_reference.json index cd95dc9..80e37a1 100644 --- a/tests/level_2_array_reference.json +++ b/tests/level_2_array_reference.json @@ -14,18 +14,18 @@ }, "properties": { "type": "reference", - "target": "Student_Array_Reference" + "target": "StudentArrayReference" } } }, - "Student_Array_Reference": { + "StudentArrayReference": { "type": "array", "schema": { "type": "reference", - "target": "Student_Property" + "target": "StudentProperty" } }, - "Student_Property": { + "StudentProperty": { "type": "struct", "properties": { "name": { diff --git a/tests/level_2_array_string.json b/tests/level_2_array_string.json index bf7852b..133a05c 100644 --- a/tests/level_2_array_string.json +++ b/tests/level_2_array_string.json @@ -14,11 +14,11 @@ }, "properties": { "type": "reference", - "target": "Student_Array_String" + "target": "StudentArrayString" } } }, - "Student_Array_String": { + "StudentArrayString": { "type": "array", "schema": { "type": "string" diff --git a/tests/level_2_map_inline_reference.json b/tests/level_2_map_inline_reference.json index 416bdf4..4472f2b 100644 --- a/tests/level_2_map_inline_reference.json +++ b/tests/level_2_map_inline_reference.json @@ -16,12 +16,12 @@ "type": "map", "schema": { "type": "reference", - "target": "Student_Property" + "target": "StudentProperty" } } } }, - "Student_Property": { + "StudentProperty": { "type": "struct", "properties": { "name": { diff --git a/tests/level_2_map_reference.json b/tests/level_2_map_reference.json index 7b4b350..0d55e39 100644 --- a/tests/level_2_map_reference.json +++ b/tests/level_2_map_reference.json @@ -14,18 +14,18 @@ }, "properties": { "type": "reference", - "target": "Student_Map_Reference" + "target": "StudentMapReference" } } }, - "Student_Map_Reference": { + "StudentMapReference": { "type": "map", "schema": { "type": "reference", - "target": "Student_Property" + "target": "StudentProperty" } }, - "Student_Property": { + "StudentProperty": { "type": "struct", "properties": { "name": { diff --git a/tests/level_2_map_string.json b/tests/level_2_map_string.json index 64b88ec..a69ac96 100644 --- a/tests/level_2_map_string.json +++ b/tests/level_2_map_string.json @@ -14,11 +14,11 @@ }, "properties": { "type": "reference", - "target": "Student_Map_String" + "target": "StudentMapString" } } }, - "Student_Map_String": { + "StudentMapString": { "type": "map", "schema": { "type": "string" diff --git a/tests/level_4_generic.json b/tests/level_4_generic.json index 23ef1d5..c6cd560 100644 --- a/tests/level_4_generic.json +++ b/tests/level_4_generic.json @@ -16,7 +16,8 @@ "template": { "T": "Student" } - } + }, + "properties": {} }, "Map": { "type": "struct", diff --git a/tests/level_5_discriminator.json b/tests/level_5_discriminator.json index 9dd9681..69c1d6e 100644 --- a/tests/level_5_discriminator.json +++ b/tests/level_5_discriminator.json @@ -18,15 +18,15 @@ "Location": { "type": "struct", "base": true, - "properties": { - "type": { - "type": "string" - } - }, "discriminator": "type", "mapping": { "Web": "web", "World": "world" + }, + "properties": { + "type": { + "type": "string" + } } }, "Web": { diff --git a/tests/sdkgen.json b/tests/sdkgen.json new file mode 100644 index 0000000..7ec1a63 --- /dev/null +++ b/tests/sdkgen.json @@ -0,0 +1,57 @@ +{ + "type": "model-java", + "require": { + "./level_1_format.json": { + "target": "../java/org/typeschema/reflection/dto/level_1_format", + "namespace": "org.typeschema.reflection.dto.level_1_format" + }, + "./level_1_simple.json": { + "target": "../java/org/typeschema/reflection/dto/level_1_simple", + "namespace": "org.typeschema.reflection.dto.level_1_simple" + }, + "./level_2_array_inline_reference.json": { + "target": "../java/org/typeschema/reflection/dto/level_2_array_inline_reference", + "namespace": "org.typeschema.reflection.dto.level_2_array_inline_reference" + }, + "./level_2_array_inline_string.json": { + "target": "../java/org/typeschema/reflection/dto/level_2_array_inline_string", + "namespace": "org.typeschema.reflection.dto.level_2_array_inline_string" + }, + "./level_2_array_reference.json": { + "target": "../java/org/typeschema/reflection/dto/level_2_array_reference", + "namespace": "org.typeschema.reflection.dto.level_2_array_reference" + }, + "./level_2_array_string.json": { + "target": "../java/org/typeschema/reflection/dto/level_2_array_string", + "namespace": "org.typeschema.reflection.dto.level_2_array_string" + }, + "./level_2_map_inline_reference.json": { + "target": "../java/org/typeschema/reflection/dto/level_2_map_inline_reference", + "namespace": "org.typeschema.reflection.dto.level_2_map_inline_reference" + }, + "./level_2_map_inline_string.json": { + "target": "../java/org/typeschema/reflection/dto/level_2_map_inline_string", + "namespace": "org.typeschema.reflection.dto.level_2_map_inline_string" + }, + "./level_2_map_reference.json": { + "target": "../java/org/typeschema/reflection/dto/level_2_map_reference", + "namespace": "org.typeschema.reflection.dto.level_2_map_reference" + }, + "./level_2_map_string.json": { + "target": "../java/org/typeschema/reflection/dto/level_2_map_string", + "namespace": "org.typeschema.reflection.dto.level_2_map_string" + }, + "./level_3_inheritance.json": { + "target": "../java/org/typeschema/reflection/dto/level_3_inheritance", + "namespace": "org.typeschema.reflection.dto.level_3_inheritance" + }, + "./level_4_generic.json": { + "target": "../java/org/typeschema/reflection/dto/level_4_generic", + "namespace": "org.typeschema.reflection.dto.level_4_generic" + }, + "./level_5_discriminator.json": { + "target": "../java/org/typeschema/reflection/dto/level_5_discriminator", + "namespace": "org.typeschema.reflection.dto.level_5_discriminator" + } + } +}