diff options
author | Keong Lim <keong.lim@huawei.com> | 2019-07-19 18:43:10 +1000 |
---|---|---|
committer | Keong Lim <keong.lim@huawei.com> | 2019-08-08 14:52:43 +1000 |
commit | c44bcf608dc25c2047af65fbfdecba7dbce11e88 (patch) | |
tree | 6120423b356919b93b979e04a2c3ff6adbf4f5a3 /aai-schema-gen/src | |
parent | 8d4ca0d78d2b34a07473d8a9293173c798d0a1f8 (diff) |
AAI-2441 update swagger-format YAML generation
update swagger-format YAML generation so that conversion to JSON
is cleaner, i.e. use n/a instead of null string in empty fields
update tests to match new output with n/a values
update generate-uml-snapshot.sh to also convert yaml to json
add the generated json files
Change-Id: Idd87ddae3c2d7490eb954ef69582edd8200f4df4
Issue-ID: AAI-2441
Signed-off-by: Keong Lim <keong.lim@huawei.com>
Diffstat (limited to 'aai-schema-gen/src')
6 files changed, 24 insertions, 24 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 a491872..9ff0fa3 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 @@ -92,8 +92,8 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { sb.append(" title: Active and Available Inventory REST API" + LINE_SEPARATOR); sb.append( " license:" + LINE_SEPARATOR + " name: Apache 2.0" + LINE_SEPARATOR + " url: http://www.apache.org/licenses/LICENSE-2.0.html" + LINE_SEPARATOR); - sb.append(" contact:" + LINE_SEPARATOR + " name:" + LINE_SEPARATOR + " url:" + LINE_SEPARATOR + " email:" + LINE_SEPARATOR); - sb.append("host:" + LINE_SEPARATOR + "basePath: " + basePath + "/" + v.toString() + LINE_SEPARATOR); + sb.append(" contact:" + LINE_SEPARATOR + " name: n/a" + LINE_SEPARATOR + " url: n/a" + LINE_SEPARATOR + " email: n/a" + LINE_SEPARATOR); + sb.append("host: n/a" + LINE_SEPARATOR + "basePath: " + basePath + "/" + v.toString() + LINE_SEPARATOR); sb.append("schemes:" + LINE_SEPARATOR + " - https\npaths:" + LINE_SEPARATOR); return sb.toString(); } diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java index 0e5c2fa..38117e5 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java @@ -237,7 +237,7 @@ public class XSDElement implements Element { if ( this.getAttribute("description") != null && this.getAttribute("description").length() > 0 ) sbParameter.append((" description: " + this.getAttribute("description") + "\n")); else - sbParameter.append((" description:\n")); + sbParameter.append((" description: n/a\n")); sbParameter.append((" required: false\n")); if ( ("java.lang.String").equals(this.getAttribute("type"))) sbParameter.append(" type: string\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 32ae998..b75a1dc 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 @@ -93,8 +93,8 @@ public class YAMLfromOXM extends OxmFileProcessor { sb.append(" title: Active and Available Inventory REST API" + LINE_SEPARATOR); sb.append( " license:" + LINE_SEPARATOR + " name: Apache 2.0\n url: http://www.apache.org/licenses/LICENSE-2.0.html" + LINE_SEPARATOR); - sb.append(" contact:" + LINE_SEPARATOR + " name:" + LINE_SEPARATOR + " url:" + LINE_SEPARATOR + " email:" + LINE_SEPARATOR); - sb.append("host:" + LINE_SEPARATOR + "basePath: " + basePath + "/" + v.toString() + LINE_SEPARATOR); + sb.append(" contact:" + LINE_SEPARATOR + " name: n/a" + LINE_SEPARATOR + " url: n/a" + LINE_SEPARATOR + " email: n/a" + LINE_SEPARATOR); + sb.append("host: n/a" + LINE_SEPARATOR + "basePath: " + basePath + "/" + v.toString() + LINE_SEPARATOR); sb.append("schemes:" + LINE_SEPARATOR + " - https\npaths:" + LINE_SEPARATOR); return sb.toString(); } 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 70262ba..d08c3e0 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 @@ -266,10 +266,10 @@ public class NodesYAMLfromOXMTest { sb.append(" name: Apache 2.0" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" url: http://www.apache.org/licenses/LICENSE-2.0.html" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" contact:" + OxmFileProcessor.LINE_SEPARATOR); - sb.append(" name:" + OxmFileProcessor.LINE_SEPARATOR); - sb.append(" url:" + OxmFileProcessor.LINE_SEPARATOR); - sb.append(" email:" + OxmFileProcessor.LINE_SEPARATOR); - sb.append("host:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" name: n/a" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" url: n/a" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" email: n/a" + OxmFileProcessor.LINE_SEPARATOR); + sb.append("host: n/a" + OxmFileProcessor.LINE_SEPARATOR); sb.append("basePath: /aai/v11" + OxmFileProcessor.LINE_SEPARATOR); sb.append("schemes:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" - https\n"); @@ -321,17 +321,17 @@ public class NodesYAMLfromOXMTest { sb.append(" null\n parameters:\n"); sb.append(" - name: global-customer-id\n"); sb.append(" in: query\n"); - sb.append(" description:\n"); + sb.append(" description: n/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); sb.append(" - name: subscriber-name\n"); sb.append(" in: query\n"); - sb.append(" description:\n"); + sb.append(" description: n/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); sb.append(" - name: subscriber-type\n"); sb.append(" in: query\n"); - sb.append(" description:\n"); + sb.append(" description: n/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); sb.append(" /nodes/service-subscriptions/service-subscription/{service-type}:\n"); @@ -376,7 +376,7 @@ public class NodesYAMLfromOXMTest { sb.append(" null\n parameters:\n"); sb.append(" - name: service-type\n"); sb.append(" in: query\n"); - sb.append(" description:\n"); + sb.append(" description: n/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); return sb.toString(); diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java index 6b21dfd..3c072f3 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java @@ -523,9 +523,9 @@ public class XSDElementTest { @Test public void testGetQueryParamYAML() { ArrayList<String> target = new ArrayList<String>(); - target.add(" - name: global-customer-id\n in: query\n description:\n required: false\n type: string\n"); - target.add(" - name: subscriber-name\n in: query\n description:\n required: false\n type: string\n"); - target.add(" - name: subscriber-type\n in: query\n description:\n required: false\n type: string\n"); + target.add(" - name: global-customer-id\n in: query\n description: n/a\n required: false\n type: string\n"); + target.add(" - name: subscriber-name\n in: query\n description: n/a\n required: false\n type: string\n"); + target.add(" - name: subscriber-type\n in: query\n description: n/a\n required: false\n type: string\n"); Vector<String> indexedProps = new Vector<String>(); for ( int i = 0; i < javaTypeNodes.getLength(); ++i ) { XSDElement javaTypeElement = new XSDElement((Element) javaTypeNodes.item(i)); 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 aa03cd2..b54408d 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 @@ -329,10 +329,10 @@ public class YAMLfromOXMTest { sb.append(" name: Apache 2.0\n"); sb.append(" url: http://www.apache.org/licenses/LICENSE-2.0.html" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" contact:" + OxmFileProcessor.LINE_SEPARATOR); - sb.append(" name:" + OxmFileProcessor.LINE_SEPARATOR); - sb.append(" url:" + OxmFileProcessor.LINE_SEPARATOR); - sb.append(" email:" + OxmFileProcessor.LINE_SEPARATOR); - sb.append("host:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" name: n/a" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" url: n/a" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" email: n/a" + OxmFileProcessor.LINE_SEPARATOR); + sb.append("host: n/a" + OxmFileProcessor.LINE_SEPARATOR); sb.append("basePath: /aai/v11" + OxmFileProcessor.LINE_SEPARATOR); sb.append("schemes:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" - https\n"); @@ -506,7 +506,7 @@ public class YAMLfromOXMTest { sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: service-type\n"); sb.append(" in: query\n"); - sb.append(" description:\n"); + sb.append(" description: n/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); sb.append(" /business/customers/customer/{global-customer-id}:\n"); @@ -643,17 +643,17 @@ public class YAMLfromOXMTest { sb.append(" null parameters:\n"); sb.append(" - name: global-customer-id\n"); sb.append(" in: query\n"); - sb.append(" description:\n"); + sb.append(" description: n/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); sb.append(" - name: subscriber-name\n"); sb.append(" in: query\n"); - sb.append(" description:\n"); + sb.append(" description: n/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); sb.append(" - name: subscriber-type\n"); sb.append(" in: query\n"); - sb.append(" description:\n"); + sb.append(" description: n/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); return sb.toString(); |