From 616e19c4fe775efd611500c23856af69287c0a15 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Fri, 25 Oct 2024 14:56:26 +0200 Subject: Openapi file is incorrect for array fields Issue-ID: AAI-4038 Change-Id: Ib429c413452be401b9a9bb27c62ef8a2ae51bccc Signed-off-by: Fiete Ostkamp --- aai-annotations/pom.xml | 2 +- aai-queries/pom.xml | 2 +- aai-schema-gen/pom.xml | 2 +- .../org/onap/aai/schemagen/genxsd/YAMLfromOXM.java | 13 +++++++++++-- .../org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java | 18 ++++++++++++------ aai-schema-service/pom.xml | 2 +- aai-schema/pom.xml | 2 +- pom.xml | 2 +- 8 files changed, 29 insertions(+), 14 deletions(-) diff --git a/aai-annotations/pom.xml b/aai-annotations/pom.xml index 09b592d..01f908e 100644 --- a/aai-annotations/pom.xml +++ b/aai-annotations/pom.xml @@ -27,7 +27,7 @@ org.onap.aai.schema-service schema-service - 1.12.5-SNAPSHOT + 1.12.6-SNAPSHOT aai-annotations aai-annotations diff --git a/aai-queries/pom.xml b/aai-queries/pom.xml index 51a8213..82381eb 100644 --- a/aai-queries/pom.xml +++ b/aai-queries/pom.xml @@ -27,7 +27,7 @@ org.onap.aai.schema-service schema-service - 1.12.5-SNAPSHOT + 1.12.6-SNAPSHOT aai-queries aai-queries diff --git a/aai-schema-gen/pom.xml b/aai-schema-gen/pom.xml index eb1247e..3fc0b86 100644 --- a/aai-schema-gen/pom.xml +++ b/aai-schema-gen/pom.xml @@ -27,7 +27,7 @@ org.onap.aai.schema-service schema-service - 1.12.5-SNAPSHOT + 1.12.6-SNAPSHOT aai-schema-gen aai-schema-gen diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java index 55767c3..577846c 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java @@ -451,8 +451,17 @@ public class YAMLfromOXM extends OxmFileProcessor { System.out.println( v + "-relationship added as array for getItemName null"); } - sbProperties.append(" type: array\n items:\n"); - sbProperties.append(" $ref: \"#/definitions/") + // https://gitlab.devops.telekom.de/tnap/development/tesla-team/portal-tnap/portal-bff/-/merge_requests/542/diffs#c00bf90500eca6b5dfcf2b014e51dace6aafeeba + // type: object + // properties: + // itemName: + // type: array + // items: + // $ref: "#/definitions/itemName" + sbProperties.append(" type: object\n properties:\n"); + sbProperties.append(" " + itemName + ":\n"); + sbProperties.append(" type: array\n items:\n"); + sbProperties.append(" $ref: \"#/definitions/") .append("".equals(itemName) ? "inventory-item-data" : itemName) .append("\"\n"); } diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java index 774b760..f04b351 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java @@ -716,9 +716,12 @@ public class YAMLfromOXMTest { sb.append(" Namespace for business related constructs\n"); sb.append(" properties:\n"); sb.append(" customers:\n"); - sb.append(" type: array\n"); - sb.append(" items:\n"); - sb.append(" $ref: \"#/definitions/customer\"\n"); + sb.append(" type: object\n"); + sb.append(" properties:\n"); + sb.append(" customer:\n"); + sb.append(" type: array\n"); + sb.append(" items:\n"); + sb.append(" $ref: \"#/definitions/customer\"\n"); sb.append(" customer:\n"); sb.append(" description: |\n"); sb.append(" customer identifiers to provide linkage back to BSS information.\n"); @@ -749,9 +752,12 @@ public class YAMLfromOXMTest { sb.append( " description: Used for optimistic concurrency. Must be empty on create, valid on update and delete.\n"); sb.append(" service-subscriptions:\n"); - sb.append(" type: array\n"); - sb.append(" items:\n"); - sb.append(" $ref: \"#/definitions/service-subscription\"\n"); + sb.append(" type: object\n"); + sb.append(" properties:\n"); + sb.append(" service-subscription:\n"); + sb.append(" type: array\n"); + sb.append(" items:\n"); + sb.append(" $ref: \"#/definitions/service-subscription\"\n"); sb.append(" customers:\n"); sb.append(" description: |\n"); sb.append( diff --git a/aai-schema-service/pom.xml b/aai-schema-service/pom.xml index 650ba43..d0d6627 100644 --- a/aai-schema-service/pom.xml +++ b/aai-schema-service/pom.xml @@ -26,7 +26,7 @@ org.onap.aai.schema-service schema-service - 1.12.5-SNAPSHOT + 1.12.6-SNAPSHOT org.onap.aai.schema-service aai-schema-service diff --git a/aai-schema/pom.xml b/aai-schema/pom.xml index 8a0289c..edc2d2f 100644 --- a/aai-schema/pom.xml +++ b/aai-schema/pom.xml @@ -27,7 +27,7 @@ org.onap.aai.schema-service schema-service - 1.12.5-SNAPSHOT + 1.12.6-SNAPSHOT aai-schema aai-schema diff --git a/pom.xml b/pom.xml index 9fc6877..97e9534 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ org.onap.aai.schema-service schema-service - 1.12.5-SNAPSHOT + 1.12.6-SNAPSHOT aai-schema-service pom -- cgit 1.2.3-korg