From cb2e04a3f6b07bcce2fb937ea906e4547dad7f5c Mon Sep 17 00:00:00 2001 From: Ivan Garcia Sainz-Aja Date: Fri, 10 Feb 2023 15:20:32 +0100 Subject: [PATCH] WARNING: "zdl.enums.enums" moved to "enums" --- .../io/zenwave360/sdk/plugins/JDLToAsyncAPIGenerator.java | 2 +- .../io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator.java | 2 +- .../ZdlToMarkdownGenerator/ZdlToMarkdownGenerator.md.hbs | 2 +- .../io/zenwave360/sdk/plugins/ZDLToOpenAPIGenerator.java | 2 +- .../sdk/generators/AbstractZDLProjectGenerator.java | 2 +- .../java/io/zenwave360/sdk/processors/ZDL2JDLProcessor.java | 2 +- .../sdk/generators/EntitiesToAvroConverterTest.java | 6 +++--- .../sdk/generators/EntitiesToSchemasConverterTest.java | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/jdl-to-asyncapi/src/main/java/io/zenwave360/sdk/plugins/JDLToAsyncAPIGenerator.java b/plugins/jdl-to-asyncapi/src/main/java/io/zenwave360/sdk/plugins/JDLToAsyncAPIGenerator.java index dfa8fcb2..d337b595 100644 --- a/plugins/jdl-to-asyncapi/src/main/java/io/zenwave360/sdk/plugins/JDLToAsyncAPIGenerator.java +++ b/plugins/jdl-to-asyncapi/src/main/java/io/zenwave360/sdk/plugins/JDLToAsyncAPIGenerator.java @@ -120,7 +120,7 @@ public List generate(Map contextModel) { toSchemasConverter.includeVersion = false; List> entities = (List) JSONPath.get(zdlModel, "$.entities[*]"); - List> enums = (List) JSONPath.get(zdlModel, "$.enums.enums[*]"); + List> enums = (List) JSONPath.get(zdlModel, "$.enums[*]"); List entitiesAndEnums = new ArrayList<>(); entitiesAndEnums.addAll(entities); entitiesAndEnums.addAll(enums); diff --git a/plugins/zdl-to-markdown/src/main/java/io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator.java b/plugins/zdl-to-markdown/src/main/java/io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator.java index ff96a951..b1362e75 100644 --- a/plugins/zdl-to-markdown/src/main/java/io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator.java +++ b/plugins/zdl-to-markdown/src/main/java/io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator.java @@ -49,7 +49,7 @@ public List generate(Map contextModel) { var associations = JSONPath.get(entity, "relationships[?(@.fieldName)].otherEntityName", List.of()); var entityAssociations = new ArrayList(); compositions.stream().map(name -> Maps.of("linkType", "--*", "entity", JSONPath.get(zdlModel, "$.entities." + name))).forEach(entityAssociations::add); - compositions.stream().map(name -> Maps.of("linkType", "--*", "entity", JSONPath.get(zdlModel, "$.enums.enums." + name))).forEach(entityAssociations::add); + compositions.stream().map(name -> Maps.of("linkType", "--*", "entity", JSONPath.get(zdlModel, "$.enums." + name))).forEach(entityAssociations::add); associations.stream().map(name -> Maps.of("linkType", "--o", "entity", JSONPath.get(zdlModel, "$.entities." + name))).forEach(entityAssociations::add); return entityAssociations.stream().filter(e -> e.get("entity") != null).collect(Collectors.toList()); }); diff --git a/plugins/zdl-to-markdown/src/main/resources/io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator/ZdlToMarkdownGenerator.md.hbs b/plugins/zdl-to-markdown/src/main/resources/io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator/ZdlToMarkdownGenerator.md.hbs index c1252eaf..6697bee8 100644 --- a/plugins/zdl-to-markdown/src/main/resources/io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator/ZdlToMarkdownGenerator.md.hbs +++ b/plugins/zdl-to-markdown/src/main/resources/io/zenwave360/sdk/plugins/ZdlToMarkdownGenerator/ZdlToMarkdownGenerator.md.hbs @@ -28,7 +28,7 @@ {{/each~}} -{{~#each zdlModel.enums.enums as |enum|}} +{{~#each zdlModel.enums as |enum|}} ### {{enum.name}} (enum) {{{enum.javadoc}}} diff --git a/plugins/zdl-to-openapi/src/main/java/io/zenwave360/sdk/plugins/ZDLToOpenAPIGenerator.java b/plugins/zdl-to-openapi/src/main/java/io/zenwave360/sdk/plugins/ZDLToOpenAPIGenerator.java index 35c3a1f8..a58ebb81 100644 --- a/plugins/zdl-to-openapi/src/main/java/io/zenwave360/sdk/plugins/ZDLToOpenAPIGenerator.java +++ b/plugins/zdl-to-openapi/src/main/java/io/zenwave360/sdk/plugins/ZDLToOpenAPIGenerator.java @@ -139,7 +139,7 @@ public List generate(Map contextModel) { } } -// List> enums = JSONPath.get(zdlModel, "$.enums.enums[*]", emptyList()); +// List> enums = JSONPath.get(zdlModel, "$.enums[*]", emptyList()); // for (Map enumValue : enums) { // Map enumSchema = converter.convertToSchema(enumValue, zdlModel); // schemas.put((String) enumValue.get("name"), enumSchema); diff --git a/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/generators/AbstractZDLProjectGenerator.java b/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/generators/AbstractZDLProjectGenerator.java index 9b62222b..4d843f77 100644 --- a/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/generators/AbstractZDLProjectGenerator.java +++ b/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/generators/AbstractZDLProjectGenerator.java @@ -41,7 +41,7 @@ public List generate(Map contextModel) { } } - Map> enums = JSONPath.get(apiModel, "$.enums.enums"); + Map> enums = JSONPath.get(apiModel, "$.enums"); for (Map enumValue : enums.values()) { if (!isGenerateEntity(enumValue)) { continue; diff --git a/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/processors/ZDL2JDLProcessor.java b/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/processors/ZDL2JDLProcessor.java index 3cc20c0b..81a5881a 100644 --- a/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/processors/ZDL2JDLProcessor.java +++ b/zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/processors/ZDL2JDLProcessor.java @@ -38,7 +38,7 @@ public Map process(Map contextModel) { JSONPath.set(model, "$.options.options.search", true); } - var enums = JSONPath.get(model, "$.enums.enums[*].name", List.of()); + var enums = JSONPath.get(model, "$.enums[*].name", List.of()); var entities = JSONPath.get(model, "$.entities[*].name", List.of()); var fields = JSONPath.get(model, "$.entities[*].fields.[*]", List.of()); for (Object field : fields) { diff --git a/zenwave-sdk-cli/src/test/java/io/zenwave360/sdk/generators/EntitiesToAvroConverterTest.java b/zenwave-sdk-cli/src/test/java/io/zenwave360/sdk/generators/EntitiesToAvroConverterTest.java index eb44c624..d80fc60a 100644 --- a/zenwave-sdk-cli/src/test/java/io/zenwave360/sdk/generators/EntitiesToAvroConverterTest.java +++ b/zenwave-sdk-cli/src/test/java/io/zenwave360/sdk/generators/EntitiesToAvroConverterTest.java @@ -25,7 +25,7 @@ public void testConvertEntityToSchema() throws Exception { EntitiesToAvroConverter converter = new EntitiesToAvroConverter().withIdType("string").withNamespace("io.example"); Map model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/resources/zdl/customer-address.zdl"); List entities = JSONPath.get(model, "entities[*]"); - List enums = JSONPath.get(model, "enums.enums[*]"); + List enums = JSONPath.get(model, "enums[*]"); List entitiesAndEnums = new ArrayList<>(); entitiesAndEnums.addAll(entities); entitiesAndEnums.addAll(enums); @@ -51,7 +51,7 @@ public void testConvertEntityToSchemaRelational() throws Exception { EntitiesToAvroConverter converter = new EntitiesToAvroConverter().withIdType("integer").withNamespace("io.example"); Map model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/resources/zdl/customer-address-relational.zdl"); List entities = JSONPath.get(model, "entities[*]"); - List enums = JSONPath.get(model, "enums.enums[*]"); + List enums = JSONPath.get(model, "enums[*]"); List entitiesAndEnums = new ArrayList<>(); entitiesAndEnums.addAll(entities); entitiesAndEnums.addAll(enums); @@ -77,7 +77,7 @@ public void testConvertEntityToSchemaFullEquipped() throws Exception { EntitiesToAvroConverter converter = new EntitiesToAvroConverter().withIdType("integer").withNamespace("io.example"); Map model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/zdl/populate-fields.zdl"); List entities = JSONPath.get(model, "entities[*]"); - List enums = JSONPath.get(model, "enums.enums[*]"); + List enums = JSONPath.get(model, "enums[*]"); List entitiesAndEnums = new ArrayList<>(); entitiesAndEnums.addAll(entities); entitiesAndEnums.addAll(enums); diff --git a/zenwave-sdk-cli/src/test/java/io/zenwave360/sdk/generators/EntitiesToSchemasConverterTest.java b/zenwave-sdk-cli/src/test/java/io/zenwave360/sdk/generators/EntitiesToSchemasConverterTest.java index 34a8b938..de853f20 100644 --- a/zenwave-sdk-cli/src/test/java/io/zenwave360/sdk/generators/EntitiesToSchemasConverterTest.java +++ b/zenwave-sdk-cli/src/test/java/io/zenwave360/sdk/generators/EntitiesToSchemasConverterTest.java @@ -25,7 +25,7 @@ public void testConvertEntityToSchema() throws Exception { EntitiesToSchemasConverter converter = new EntitiesToSchemasConverter().withIdType("string"); Map model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/resources/zdl/customer-address.zdl"); List entities = JSONPath.get(model, "entities[*]"); - List enums = JSONPath.get(model, "enums.enums[*]"); + List enums = JSONPath.get(model, "enums[*]"); List entitiesAndEnums = new ArrayList<>(); entitiesAndEnums.addAll(entities); entitiesAndEnums.addAll(enums); @@ -47,7 +47,7 @@ public void testConvertEntityToSchemaRelational() throws Exception { EntitiesToSchemasConverter converter = new EntitiesToSchemasConverter().withIdType("number", "int64"); Map model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/resources/zdl/customer-address-relational.zdl"); List entities = JSONPath.get(model, "entities[*]"); - List enums = JSONPath.get(model, "enums.enums[*]"); + List enums = JSONPath.get(model, "enums[*]"); List entitiesAndEnums = new ArrayList<>(); entitiesAndEnums.addAll(entities); entitiesAndEnums.addAll(enums); @@ -69,7 +69,7 @@ public void testConvertEntityToSchemaFullEquipped() throws Exception { EntitiesToSchemasConverter converter = new EntitiesToSchemasConverter().withIdType("number", "int64"); Map model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/zdl/populate-fields.zdl"); List entities = JSONPath.get(model, "entities[*]"); - List enums = JSONPath.get(model, "enums.enums[*]"); + List enums = JSONPath.get(model, "enums[*]"); List entitiesAndEnums = new ArrayList<>(); entitiesAndEnums.addAll(entities); entitiesAndEnums.addAll(enums);