aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-04-02 13:33:19 +0200
committersebdet <sebastien.determe@intl.att.com>2020-04-02 14:24:38 +0200
commitf4c8c80c3b6e4da48592fed9de79d285e29744b5 (patch)
tree99b31d482505f096d323ce6e33c654f5dc4c896a /src/main
parenteb4e4ca9b9eb2a2f2fe16d8e5a1bc9ac463c6ebe (diff)
Change generated json schema
Add tabs-top format for array in the policy json schema generated + add a default case for payload Issue-ID: CLAMP-810 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: I5cca893cda57838c0244fc82974dd5519e787506
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java10
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java b/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
index b81e46bf4..81e30cf43 100644
--- a/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
+++ b/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
@@ -60,6 +60,7 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess {
private static void generatePayload(JsonObject childObject, Service serviceModel) {
generatePayloadPerResource(childObject, "VF", serviceModel);
generatePayloadPerResource(childObject, "PNF", serviceModel);
+ addToJsonArray(childObject, "anyOf", createBlankEntry());
}
private static void generateOperation(JsonObject childObject, Service serviceModel) {
@@ -113,6 +114,15 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess {
addToJsonArray(childObject, "anyOf", schemaAnyOf);
}
+ private static JsonArray createBlankEntry() {
+ JsonArray result = new JsonArray();
+ JsonObject blankObject = new JsonObject();
+ blankObject.addProperty("title", "User defined");
+ blankObject.add("properties", new JsonObject());
+ result.add(blankObject);
+ return result;
+ }
+
private static JsonObject createPayloadProperty(JsonObject workFlow, JsonObject controllerProperties) {
JsonObject payloadResult = new JsonObject();
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java b/src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java
index e1d493a35..9721e33d9 100644
--- a/src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java
+++ b/src/main/java/org/onap/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java
@@ -259,6 +259,7 @@ public class ToscaConverterToJsonSchema {
JsonObject componentAsItem = child.getJsonSchemaOfToscaElement(nameComponent);
if (currentPropertyJsonTemplate.hasFields("properties")) {
propertiesInJson.add("items", componentAsItem);
+ propertiesInJson.addProperty("format", "tabs-top");
}
break;
}
@@ -271,6 +272,7 @@ public class ToscaConverterToJsonSchema {
this.extractSpecificFieldFromMap(toscaElementProperty, "entry_schema");
itemContainer.addProperty("type", valueInEntrySchema);
propertiesInJson.add("items", itemContainer);
+ propertiesInJson.addProperty("format", "tabs-top");
}
// MAP Case, for now nothing