aboutsummaryrefslogtreecommitdiffstats
path: root/graph-inventory/fluent-builder-maven-plugin/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'graph-inventory/fluent-builder-maven-plugin/src/main')
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java7
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java2
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java6
3 files changed, 5 insertions, 10 deletions
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
index 23a1a812df..4a8b7d90c6 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
@@ -325,13 +325,8 @@ public class FluentGenerator {
String value;
String name;
- if (params.group(2) != null) {
- name = params.group(2);
- } else {
- name = params.group(1);
- }
value = params.group(1);
-
+ name = params.group(2);
name = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name);
classFields.add(FieldSpec.builder(String.class, name, Modifier.PUBLIC, Modifier.FINAL)
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
index 8be22e1dcc..d27794c127 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
@@ -7,5 +7,5 @@ public class Patterns {
public static final Pattern pluralPattern = Pattern.compile(".*(?<partial>/(?<name>[^{]*$))");
public static final Pattern singularPattern = Pattern.compile(".*(?<partial>/(?<name>[^/{}]*)/\\{.*$)");
public static final Pattern topLevelPattern = Pattern.compile("^/([^/]+)/.*");
- public static final Pattern urlTemplatePattern = Pattern.compile("\\{([^}.]+(?:\\.([^}]+))?)\\}");
+ public static final Pattern urlTemplatePattern = Pattern.compile("\\{((?:.+\\.)?([^}.]+))\\}");
}
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
index 42305488bc..ec09af8a4e 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
@@ -125,8 +125,6 @@ public class SwaggerConverter {
}
}
- log.debug(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(output));
-
for (Map.Entry<String, ObjectType> item : output.entrySet()) {
if (item.getValue().getType().equals("plural")) {
@@ -156,7 +154,7 @@ public class SwaggerConverter {
Matcher templates = Patterns.urlTemplatePattern.matcher(item.getValue().getPartialUri());
List<String> localFields = new ArrayList<>();
while (templates.find()) {
- localFields.add(templates.group(1));
+ localFields.add(templates.group(2));
}
item.getValue().setFields(item.getValue().getFields().stream()
.filter(f -> localFields.contains(f.getName())).collect(Collectors.toList()));
@@ -166,6 +164,8 @@ public class SwaggerConverter {
output.values().stream().filter(item -> item.getType().equals("plural"))
.forEach(item -> item.getChildren().clear());
+ log.debug(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(output));
+
return output;
}
}