|
@@ -87,13 +87,14 @@ public class AvroJsonSchemaConverterTest {
|
|
|
+ "{\"$ref\":\"#/definitions/RecordInnerMessage\"}},"
|
|
|
+ "\"required\":[\"record\"],\"definitions\":"
|
|
|
+ "{\"RecordInnerMessage\":{\"type\":\"object\",\""
|
|
|
- + "properties\":{\"long_text\":{\"type\":[\"object\", \"null\"],"
|
|
|
- + "\"properties\":{\"string\":{\"type\":\"string\"}}},"
|
|
|
- + "\"array\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},"
|
|
|
- + "\"id\":{\"type\":\"integer\"},\"text\":{\"type\":\"string\"},"
|
|
|
- + "\"map\":{\"type\":\"object\",\"additionalProperties\":"
|
|
|
- + "{\"type\":\"integer\"}},\"order\":{\"type\":\"string\","
|
|
|
- + "\"enum\":[\"SPADES\",\"HEARTS\",\"DIAMONDS\",\"CLUBS\"]}},"
|
|
|
+ + "properties\":{\"long_text\":{\"oneOf\":[{\"type\":\"null\"},"
|
|
|
+ + "{\"type\":\"object\",\"properties\":{\"string\":"
|
|
|
+ + "{\"type\":\"string\"}}}]},\"array\":{\"type\":\"array\",\"items\":"
|
|
|
+ + "{\"type\":\"string\"}},\"id\":{\"type\":\"integer\"},\"text\":"
|
|
|
+ + "{\"type\":\"string\"},\"map\":{\"type\":\"object\","
|
|
|
+ + "\"additionalProperties\":{\"type\":\"integer\"}},"
|
|
|
+ + "\"order\":{\"enum\":[\"SPADES\",\"HEARTS\",\"DIAMONDS\",\"CLUBS\"],"
|
|
|
+ + "\"type\":\"string\"}},"
|
|
|
+ "\"required\":[\"id\",\"text\",\"order\",\"array\",\"map\"]}}}";
|
|
|
|
|
|
final JsonSchema convertRecord = converter.convert(basePath, recordSchema);
|
|
@@ -151,10 +152,10 @@ public class AvroJsonSchemaConverterTest {
|
|
|
"{\"$id\":\"http://example.com/Message\","
|
|
|
+ "\"$schema\":\"https://json-schema.org/draft/2020-12/schema\","
|
|
|
+ "\"type\":\"object\",\"properties\":{\"text\":"
|
|
|
- + "{\"type\":[\"object\", \"null\"],\"properties\":{\"string\":"
|
|
|
- + "{\"type\":\"string\"}}},\"value\":{\"type\":[\"object\", \"null\"],"
|
|
|
- + "\"properties\":{\"string\":{\"type\":\"string\"},"
|
|
|
- + "\"long\":{\"type\":\"integer\"}}}}}";
|
|
|
+ + "{\"oneOf\":[{\"type\":\"null\"},{\"type\":\"object\","
|
|
|
+ + "\"properties\":{\"string\":{\"type\":\"string\"}}}]},\"value\":"
|
|
|
+ + "{\"oneOf\":[{\"type\":\"null\"},{\"type\":\"object\","
|
|
|
+ + "\"properties\":{\"string\":{\"type\":\"string\"},\"long\":{\"type\":\"integer\"}}}]}}}";
|
|
|
|
|
|
final JsonSchema convert = converter.convert(basePath, recordSchema);
|
|
|
Assertions.assertEquals(
|