Skip to content

Commit

Permalink
WARNING: "zdl.enums.enums" moved to "enums"
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangsa committed Feb 10, 2023
1 parent 0b59b65 commit cb2e04a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public List<TemplateOutput> generate(Map<String, Object> contextModel) {
toSchemasConverter.includeVersion = false;

List<Map<String, Object>> entities = (List) JSONPath.get(zdlModel, "$.entities[*]");
List<Map<String, Object>> enums = (List) JSONPath.get(zdlModel, "$.enums.enums[*]");
List<Map<String, Object>> enums = (List) JSONPath.get(zdlModel, "$.enums[*]");
List<Map> entitiesAndEnums = new ArrayList<>();
entitiesAndEnums.addAll(entities);
entitiesAndEnums.addAll(enums);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public List<TemplateOutput> generate(Map<String, Object> contextModel) {
var associations = JSONPath.get(entity, "relationships[?(@.fieldName)].otherEntityName", List.of());
var entityAssociations = new ArrayList<Map>();
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());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

{{/each~}}

{{~#each zdlModel.enums.enums as |enum|}}
{{~#each zdlModel.enums as |enum|}}
### <a name="entity_{{enum.name}}"></a> {{enum.name}} (enum)

{{{enum.javadoc}}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public List<TemplateOutput> generate(Map<String, Object> contextModel) {
}
}

// List<Map<String, Object>> enums = JSONPath.get(zdlModel, "$.enums.enums[*]", emptyList());
// List<Map<String, Object>> enums = JSONPath.get(zdlModel, "$.enums[*]", emptyList());
// for (Map<String, Object> enumValue : enums) {
// Map<String, Object> enumSchema = converter.convertToSchema(enumValue, zdlModel);
// schemas.put((String) enumValue.get("name"), enumSchema);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public List<TemplateOutput> generate(Map<String, Object> contextModel) {
}
}

Map<String, Map<String, Object>> enums = JSONPath.get(apiModel, "$.enums.enums");
Map<String, Map<String, Object>> enums = JSONPath.get(apiModel, "$.enums");
for (Map<String, Object> enumValue : enums.values()) {
if (!isGenerateEntity(enumValue)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Map<String, Object> process(Map<String, Object> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void testConvertEntityToSchema() throws Exception {
EntitiesToAvroConverter converter = new EntitiesToAvroConverter().withIdType("string").withNamespace("io.example");
Map<String, Object> model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/resources/zdl/customer-address.zdl");
List<Map> entities = JSONPath.get(model, "entities[*]");
List<Map> enums = JSONPath.get(model, "enums.enums[*]");
List<Map> enums = JSONPath.get(model, "enums[*]");
List<Map> entitiesAndEnums = new ArrayList<>();
entitiesAndEnums.addAll(entities);
entitiesAndEnums.addAll(enums);
Expand All @@ -51,7 +51,7 @@ public void testConvertEntityToSchemaRelational() throws Exception {
EntitiesToAvroConverter converter = new EntitiesToAvroConverter().withIdType("integer").withNamespace("io.example");
Map<String, Object> model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/resources/zdl/customer-address-relational.zdl");
List<Map> entities = JSONPath.get(model, "entities[*]");
List<Map> enums = JSONPath.get(model, "enums.enums[*]");
List<Map> enums = JSONPath.get(model, "enums[*]");
List<Map> entitiesAndEnums = new ArrayList<>();
entitiesAndEnums.addAll(entities);
entitiesAndEnums.addAll(enums);
Expand All @@ -77,7 +77,7 @@ public void testConvertEntityToSchemaFullEquipped() throws Exception {
EntitiesToAvroConverter converter = new EntitiesToAvroConverter().withIdType("integer").withNamespace("io.example");
Map<String, Object> model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/zdl/populate-fields.zdl");
List<Map> entities = JSONPath.get(model, "entities[*]");
List<Map> enums = JSONPath.get(model, "enums.enums[*]");
List<Map> enums = JSONPath.get(model, "enums[*]");
List<Map> entitiesAndEnums = new ArrayList<>();
entitiesAndEnums.addAll(entities);
entitiesAndEnums.addAll(enums);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void testConvertEntityToSchema() throws Exception {
EntitiesToSchemasConverter converter = new EntitiesToSchemasConverter().withIdType("string");
Map<String, Object> model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/resources/zdl/customer-address.zdl");
List<Map> entities = JSONPath.get(model, "entities[*]");
List<Map> enums = JSONPath.get(model, "enums.enums[*]");
List<Map> enums = JSONPath.get(model, "enums[*]");
List<Map> entitiesAndEnums = new ArrayList<>();
entitiesAndEnums.addAll(entities);
entitiesAndEnums.addAll(enums);
Expand All @@ -47,7 +47,7 @@ public void testConvertEntityToSchemaRelational() throws Exception {
EntitiesToSchemasConverter converter = new EntitiesToSchemasConverter().withIdType("number", "int64");
Map<String, Object> model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/resources/zdl/customer-address-relational.zdl");
List<Map> entities = JSONPath.get(model, "entities[*]");
List<Map> enums = JSONPath.get(model, "enums.enums[*]");
List<Map> enums = JSONPath.get(model, "enums[*]");
List<Map> entitiesAndEnums = new ArrayList<>();
entitiesAndEnums.addAll(entities);
entitiesAndEnums.addAll(enums);
Expand All @@ -69,7 +69,7 @@ public void testConvertEntityToSchemaFullEquipped() throws Exception {
EntitiesToSchemasConverter converter = new EntitiesToSchemasConverter().withIdType("number", "int64");
Map<String, Object> model = loadZDLModelFromResource("classpath:io/zenwave360/sdk/zdl/populate-fields.zdl");
List<Map> entities = JSONPath.get(model, "entities[*]");
List<Map> enums = JSONPath.get(model, "enums.enums[*]");
List<Map> enums = JSONPath.get(model, "enums[*]");
List<Map> entitiesAndEnums = new ArrayList<>();
entitiesAndEnums.addAll(entities);
entitiesAndEnums.addAll(enums);
Expand Down

0 comments on commit cb2e04a

Please sign in to comment.