diff options
author | vani.kv <vani.kv@accenture.com> | 2025-01-05 21:39:05 +0530 |
---|---|---|
committer | Vani KV <vani.kv@accenture.com> | 2025-01-06 04:29:05 +0000 |
commit | 8a9c706cb1883fd829c4c2943221cc7111d64b47 (patch) | |
tree | be7338da9f1d21da780fa46d01e31af15f7225ea /aai-schema-gen | |
parent | 5b3d82a2d9aea7359a46a63f479cf54ec0d525fe (diff) |
Openapi file is incorrect for array fields
Issue-ID: AAI-4038
Change-Id: Ifc686c1afdadd13771ff0c95910bd9639c65459c
Signed-off-by: vani.kv <vani.kv@accenture.com>
Diffstat (limited to 'aai-schema-gen')
3 files changed, 17 insertions, 15 deletions
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java index f4d15b2..8a06c37 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java @@ -412,8 +412,11 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { sbProperties.append(" $ref: \"#/definitions/").append(itemName) .append("\"\n"); } else { - sbProperties.append(" type: array\n items:\n"); - sbProperties.append(" $ref: \"#/definitions/") + // Open API Schema definition changes + 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) ? "aai-internal" : itemName) .append("\"\n"); } 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 577846c..1b746d5 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,13 +451,6 @@ public class YAMLfromOXM extends OxmFileProcessor { System.out.println( v + "-relationship added as array for getItemName null"); } - // 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"); diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java index 87e967e..7139b43 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java @@ -412,9 +412,12 @@ public class NodesYAMLfromOXMTest { 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"); @@ -445,9 +448,12 @@ public class NodesYAMLfromOXMTest { 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( |