diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-12-07 13:52:46 +0000 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-12-07 15:55:11 +0000 |
commit | 1e2d336a332c3b58d07ebc6d4e9c448178281ee3 (patch) | |
tree | 8e4f3a202a7927469ac7af5800ce3ad0bfa46348 /aai-schema-gen | |
parent | 33db2e9d0c0e9da96a7507b1695cbfa2e5394489 (diff) |
Generated AAI Swagger file has schema violations
Fixes for violations
- provide a valid host (localhost) for the `host` key
- remove `example` keys for parameters
- remove `also requires` property from definitions
Other changes
- remove the license header from description and add it instead as a yaml comment (like we do it for any other file)
- remove the `contact` block since it does not contain actual contact information
- remove the reference to the AT&T wiki for the default response codes
- remove `description: n/a` values in parameters that are set when there is no description available
Issue-ID: AAI-3611
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: I057f7f3a49a861891c49b52bff80e5a9810f18a7
Diffstat (limited to 'aai-schema-gen')
8 files changed, 161 insertions, 121 deletions
diff --git a/aai-schema-gen/pom.xml b/aai-schema-gen/pom.xml index 31da141..5858cfe 100644 --- a/aai-schema-gen/pom.xml +++ b/aai-schema-gen/pom.xml @@ -202,7 +202,7 @@ </systemProperty> <systemProperty> <key>yamlresponses_label</key> - <value>Response codes found in [response codes]</value> + <value>Response codes are uniform across all endpoints.</value> </systemProperty> <systemProperty> <key>schema.configuration.location</key> @@ -472,7 +472,7 @@ </systemProperty> <systemProperty> <key>yamlresponses_label</key> - <value>Response codes found in [response codes]</value> + <value>Response codes are uniform across all endpoints.</value> </systemProperty> <systemProperty> <key>schema.configuration.location</key> diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/GenerateXsd.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/GenerateXsd.java index f9e7b4d..b69f036 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/GenerateXsd.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/GenerateXsd.java @@ -189,8 +189,8 @@ public class GenerateXsd { "generating swagger yaml file requires yamlresponses_url and yamlresponses_label properties"); System.exit(1); } else { - responsesUrl = "description: " + "Response codes found in [response codes](" - + responsesLabel + ").\n"; + responsesUrl = + "description: " + "Response codes are uniform across all endpoints.\n"; } } /* 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 92cc4a0..f4d15b2 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,25 +92,44 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { @Override public String getDocumentHeader() { StringBuilder sb = new StringBuilder(); + sb.append("#").append(LINE_SEPARATOR).append( + "# ============LICENSE_START=======================================================") + .append(LINE_SEPARATOR).append("# org.onap.aai").append(LINE_SEPARATOR) + .append( + "# ================================================================================") + .append(LINE_SEPARATOR) + .append("# Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.") + .append(LINE_SEPARATOR) + .append( + "# ================================================================================") + .append(LINE_SEPARATOR) + .append( + "# Licensed under the Creative Commons License, Attribution 4.0 Intl. (the \"License\");") + .append(LINE_SEPARATOR) + .append("# you may not use this file except in compliance with the License.") + .append(LINE_SEPARATOR).append("# You may obtain a copy of the License at") + .append(LINE_SEPARATOR).append("# <p>").append(LINE_SEPARATOR) + .append("# https://creativecommons.org/licenses/by/4.0/").append(LINE_SEPARATOR) + .append("# <p>").append(LINE_SEPARATOR) + .append("# Unless required by applicable law or agreed to in writing, software") + .append(LINE_SEPARATOR) + .append("# distributed under the License is distributed on an \"AS IS\" BASIS,") + .append(LINE_SEPARATOR) + .append("# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.") + .append(LINE_SEPARATOR) + .append("# See the License for the specific language governing permissions and") + .append(LINE_SEPARATOR).append("# limitations under the License.") + .append(LINE_SEPARATOR) + .append( + "# ============LICENSE_END=========================================================") + .append(LINE_SEPARATOR).append("#").append(LINE_SEPARATOR).append(LINE_SEPARATOR); sb.append("swagger: \"2.0\"\ninfo:").append(LINE_SEPARATOR).append(" "); sb.append("description: |"); if (versionSupportsSwaggerDiff(v.toString())) { - sb.append("\n\n [Differences versus the previous schema version](" + "apidocs") + sb.append("\n [Differences versus the previous schema version](" + "apidocs") .append(basePath).append("/aai_swagger_").append(v.toString()).append(".diff)"); } sb.append(DOUBLE_LINE_SEPARATOR) - .append( - " Copyright © 2017-18 AT&T Intellectual Property. All rights reserved.") - .append(OxmFileProcessor.DOUBLE_LINE_SEPARATOR) - .append( - " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except in compliance with the License.") - .append(DOUBLE_LINE_SEPARATOR) - .append( - " You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)") - .append(DOUBLE_LINE_SEPARATOR) - .append( - " Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.") - .append(OxmFileProcessor.DOUBLE_LINE_SEPARATOR) .append(" This document is best viewed with Firefox or Chrome. "); sb.append( "Nodes can be found by opening the models link below and finding the node-type. "); @@ -121,10 +140,7 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { .append(LINE_SEPARATOR) .append(" url: http://www.apache.org/licenses/LICENSE-2.0.html") .append(LINE_SEPARATOR); - sb.append(" contact:").append(LINE_SEPARATOR).append(" name: n/a") - .append(LINE_SEPARATOR).append(" url: n/a").append(LINE_SEPARATOR) - .append(" email: n/a").append(LINE_SEPARATOR); - sb.append("host: n/a").append(LINE_SEPARATOR).append("basePath: ").append(basePath) + sb.append("host: localhost").append(LINE_SEPARATOR).append("basePath: ").append(basePath) .append("/").append(v.toString()).append(LINE_SEPARATOR); sb.append("schemes:").append(LINE_SEPARATOR).append(" - https\npaths:") .append(LINE_SEPARATOR); 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 fa00b5e..7cddc7b 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 @@ -268,8 +268,6 @@ public class XSDElement implements Element { && this.getAttribute("description").length() > 0) { sbParameter.append(" description: ").append(this.getAttribute("description")) .append("\n"); - } else { - sbParameter.append((" description: n/a\n")); } sbParameter.append((" required: false\n")); if (("java.lang.String").equals(this.getAttribute("type"))) { @@ -335,10 +333,6 @@ public class XSDElement implements Element { if (("java.lang.Boolean").equals(this.getAttribute("type"))) { sbParameter.append(" type: boolean\n"); } - if (StringUtils.isNotBlank(this.getAttribute("name"))) { - sbParameter.append(" example: " + "__") - .append(this.getAttribute("name").toUpperCase()).append("__").append("\n"); - } return sbParameter.toString(); } @@ -522,11 +516,6 @@ public class XSDElement implements Element { " *This property can be used as a filter to find the start node for a dsl query\n"); } } - String elementAlsoRequiresProperty = this.getRequiresProperty(); - if (StringUtils.isNotEmpty(elementAlsoRequiresProperty)) { - sbProperties.append(" also requires: ").append(elementAlsoRequiresProperty) - .append("\n"); - } return sbProperties.toString(); } 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 0ded250..55767c3 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,25 +93,44 @@ public class YAMLfromOXM extends OxmFileProcessor { @Override public String getDocumentHeader() { StringBuilder sb = new StringBuilder(); + sb.append("#").append(LINE_SEPARATOR).append( + "# ============LICENSE_START=======================================================") + .append(LINE_SEPARATOR).append("# org.onap.aai").append(LINE_SEPARATOR) + .append( + "# ================================================================================") + .append(LINE_SEPARATOR) + .append("# Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.") + .append(LINE_SEPARATOR) + .append( + "# ================================================================================") + .append(LINE_SEPARATOR) + .append( + "# Licensed under the Creative Commons License, Attribution 4.0 Intl. (the \"License\");") + .append(LINE_SEPARATOR) + .append("# you may not use this file except in compliance with the License.") + .append(LINE_SEPARATOR).append("# You may obtain a copy of the License at") + .append(LINE_SEPARATOR).append("# <p>").append(LINE_SEPARATOR) + .append("# https://creativecommons.org/licenses/by/4.0/").append(LINE_SEPARATOR) + .append("# <p>").append(LINE_SEPARATOR) + .append("# Unless required by applicable law or agreed to in writing, software") + .append(LINE_SEPARATOR) + .append("# distributed under the License is distributed on an \"AS IS\" BASIS,") + .append(LINE_SEPARATOR) + .append("# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.") + .append(LINE_SEPARATOR) + .append("# See the License for the specific language governing permissions and") + .append(LINE_SEPARATOR).append("# limitations under the License.") + .append(LINE_SEPARATOR) + .append( + "# ============LICENSE_END=========================================================") + .append(LINE_SEPARATOR).append("#").append(LINE_SEPARATOR).append(LINE_SEPARATOR); sb.append("swagger: \"2.0\"\ninfo:").append(LINE_SEPARATOR).append(" "); sb.append("description: |"); if (versionSupportsSwaggerDiff(v.toString())) { - sb.append("\n\n [Differences versus the previous schema version](" + "apidocs" + sb.append("\n [Differences versus the previous schema version](" + "apidocs" + basePath + "/aai_swagger_" + v.toString() + ".diff)"); } sb.append(DOUBLE_LINE_SEPARATOR) - .append( - " Copyright © 2017-18 AT&T Intellectual Property. All rights reserved.") - .append(OxmFileProcessor.DOUBLE_LINE_SEPARATOR) - .append( - " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except in compliance with the License.") - .append(DOUBLE_LINE_SEPARATOR) - .append( - " You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)") - .append(DOUBLE_LINE_SEPARATOR) - .append( - " Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.") - .append(OxmFileProcessor.DOUBLE_LINE_SEPARATOR) .append(" This document is best viewed with Firefox or Chrome. "); sb.append( "Nodes can be found by opening the models link below and finding the node-type. "); @@ -122,10 +141,7 @@ public class YAMLfromOXM extends OxmFileProcessor { .append( " name: Apache 2.0\n url: http://www.apache.org/licenses/LICENSE-2.0.html") .append(LINE_SEPARATOR); - sb.append(" contact:").append(LINE_SEPARATOR).append(" name: n/a") - .append(LINE_SEPARATOR).append(" url: n/a").append(LINE_SEPARATOR) - .append(" email: n/a").append(LINE_SEPARATOR); - sb.append("host: n/a").append(LINE_SEPARATOR).append("basePath: ").append(basePath) + sb.append("host: localhost").append(LINE_SEPARATOR).append("basePath: ").append(basePath) .append("/").append(v.toString()).append(LINE_SEPARATOR); sb.append("schemes:").append(LINE_SEPARATOR).append(" - https\npaths:") .append(LINE_SEPARATOR); 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 ac225f0..d87bdf7 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 @@ -245,27 +245,49 @@ public class NodesYAMLfromOXMTest { public String YAMLheader() { StringBuilder sb = new StringBuilder(1500); + sb.append("#").append(OxmFileProcessor.LINE_SEPARATOR).append( + "# ============LICENSE_START=======================================================") + .append(OxmFileProcessor.LINE_SEPARATOR).append("# org.onap.aai") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append( + "# ================================================================================") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append( + "# ================================================================================") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append( + "# Licensed under the Creative Commons License, Attribution 4.0 Intl. (the \"License\");") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# you may not use this file except in compliance with the License.") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# You may obtain a copy of the License at") + .append(OxmFileProcessor.LINE_SEPARATOR).append("# <p>") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# https://creativecommons.org/licenses/by/4.0/") + .append(OxmFileProcessor.LINE_SEPARATOR).append("# <p>") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# Unless required by applicable law or agreed to in writing, software") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# distributed under the License is distributed on an \"AS IS\" BASIS,") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# See the License for the specific language governing permissions and") + .append(OxmFileProcessor.LINE_SEPARATOR).append("# limitations under the License.") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append( + "# ============LICENSE_END=========================================================") + .append(OxmFileProcessor.LINE_SEPARATOR).append("#") + .append(OxmFileProcessor.LINE_SEPARATOR).append(OxmFileProcessor.LINE_SEPARATOR); sb.append("swagger: \"2.0\"\n"); sb.append("info:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" description: |\n"); - sb.append("\n"); sb.append( " [Differences versus the previous schema version](apidocs/aai/aai_swagger_v11.diff)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); sb.append( - " Copyright © 2017-18 AT&T Intellectual Property. All rights reserved." - + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); - sb.append( - " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except in compliance with the License." - + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); - sb.append(" You may obtain a copy of the License at\n"); - sb.append("\n"); - sb.append(" (https://creativecommons.org/licenses/by/4.0/)" - + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); - sb.append( - " Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." - + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); - sb.append( " This document is best viewed with Firefox or Chrome. Nodes can be found by opening the models link below and finding the node-type. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR); sb.append(" version: \"v11\"" + OxmFileProcessor.LINE_SEPARATOR); @@ -275,11 +297,7 @@ 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: 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("host: localhost" + OxmFileProcessor.LINE_SEPARATOR); sb.append("basePath: /aai/v11" + OxmFileProcessor.LINE_SEPARATOR); sb.append("schemes:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" - https\n"); @@ -312,7 +330,6 @@ public class NodesYAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" /nodes/customers?parameter=value[¶meter2=value2]:\n"); sb.append(" get:\n"); sb.append(" tags:\n"); @@ -332,17 +349,14 @@ 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/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/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/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); sb.append(" /nodes/service-subscriptions/service-subscription/{service-type}:\n"); @@ -369,7 +383,6 @@ public class NodesYAMLfromOXMTest { " description: Value defined by orchestration to identify this service.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __SERVICE-TYPE__\n"); sb.append(" /nodes/service-subscriptions?parameter=value[¶meter2=value2]:\n"); sb.append(" get:\n"); sb.append(" tags:\n"); @@ -389,7 +402,6 @@ public class NodesYAMLfromOXMTest { sb.append(" null\n parameters:\n"); sb.append(" - name: service-type\n"); sb.append(" in: query\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 7ce87af..1442ba9 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 @@ -20,7 +20,9 @@ package org.onap.aai.schemagen.genxsd; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.both; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.collection.IsIn.in; import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; import static org.hamcrest.core.Every.everyItem; @@ -29,7 +31,11 @@ import static org.junit.Assert.assertThat; import java.io.IOException; import java.io.StringReader; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Vector; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; @@ -592,11 +598,11 @@ public class XSDElementTest { public void testGetQueryParamYAML() { ArrayList<String> target = new ArrayList<String>(); target.add( - " - name: global-customer-id\n in: query\n description: n/a\n required: false\n type: string\n"); + " - name: global-customer-id\n in: query\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"); + " - name: subscriber-name\n in: query\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"); + " - name: subscriber-type\n in: query\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)); @@ -628,17 +634,17 @@ public class XSDElementTest { public void testGetPathParamYAML() { ArrayList<String> target = new ArrayList<String>(); target.add( - " - name: Inventory\n in: path\n description: Inventory\n required: true\n example: __INVENTORY__\n"); + " - name: Inventory\n in: path\n description: Inventory\n required: true\n"); target.add( - " - name: Business\n in: path\n description: Business\n required: true\n example: __BUSINESS__\n"); + " - name: Business\n in: path\n description: Business\n required: true\n"); target.add( - " - name: Customers\n in: path\n description: Customers\n required: true\n example: __CUSTOMERS__\n"); + " - name: Customers\n in: path\n description: Customers\n required: true\n"); target.add( - " - name: Customer\n in: path\n description: Customer\n required: true\n example: __CUSTOMER__\n"); + " - name: Customer\n in: path\n description: Customer\n required: true\n"); target.add( - " - name: ServiceSubscriptions\n in: path\n description: ServiceSubscriptions\n required: true\n example: __SERVICESUBSCRIPTIONS__\n"); + " - name: ServiceSubscriptions\n in: path\n description: ServiceSubscriptions\n required: true\n"); target.add( - " - name: ServiceSubscription\n in: path\n description: ServiceSubscription\n required: true\n example: __SERVICESUBSCRIPTION__\n"); + " - name: ServiceSubscription\n in: path\n description: ServiceSubscription\n required: true\n"); List<String> pathParams = new ArrayList<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 ed13981..774b760 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 @@ -311,27 +311,49 @@ public class YAMLfromOXMTest { public String YAMLheader() { StringBuilder sb = new StringBuilder(1500); + sb.append("#").append(OxmFileProcessor.LINE_SEPARATOR).append( + "# ============LICENSE_START=======================================================") + .append(OxmFileProcessor.LINE_SEPARATOR).append("# org.onap.aai") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append( + "# ================================================================================") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append( + "# ================================================================================") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append( + "# Licensed under the Creative Commons License, Attribution 4.0 Intl. (the \"License\");") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# you may not use this file except in compliance with the License.") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# You may obtain a copy of the License at") + .append(OxmFileProcessor.LINE_SEPARATOR).append("# <p>") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# https://creativecommons.org/licenses/by/4.0/") + .append(OxmFileProcessor.LINE_SEPARATOR).append("# <p>") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# Unless required by applicable law or agreed to in writing, software") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# distributed under the License is distributed on an \"AS IS\" BASIS,") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append("# See the License for the specific language governing permissions and") + .append(OxmFileProcessor.LINE_SEPARATOR).append("# limitations under the License.") + .append(OxmFileProcessor.LINE_SEPARATOR) + .append( + "# ============LICENSE_END=========================================================") + .append(OxmFileProcessor.LINE_SEPARATOR).append("#") + .append(OxmFileProcessor.LINE_SEPARATOR).append(OxmFileProcessor.LINE_SEPARATOR); sb.append("swagger: \"2.0\"\n"); sb.append("info:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" description: |\n"); - sb.append("\n"); sb.append( " [Differences versus the previous schema version](apidocs/aai/aai_swagger_v11.diff)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); sb.append( - " Copyright © 2017-18 AT&T Intellectual Property. All rights reserved." - + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); - sb.append( - " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except in compliance with the License." - + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); - sb.append(" You may obtain a copy of the License at\n"); - sb.append("\n"); - sb.append(" (https://creativecommons.org/licenses/by/4.0/)" - + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); - sb.append( - " Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." - + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); - sb.append( " This document is best viewed with Firefox or Chrome. Nodes can be found by opening the models link below and finding the node-type. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR); sb.append(" version: \"v11\"" + OxmFileProcessor.LINE_SEPARATOR); @@ -341,11 +363,7 @@ 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: 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("host: localhost" + OxmFileProcessor.LINE_SEPARATOR); sb.append("basePath: /aai/v11" + OxmFileProcessor.LINE_SEPARATOR); sb.append("schemes:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" - https\n"); @@ -380,14 +398,12 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: service-type\n"); sb.append(" in: path\n"); sb.append( " description: Value defined by orchestration to identify this service.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __SERVICE-TYPE__\n"); sb.append(" put:\n"); sb.append(" tags:\n"); sb.append(" - Business\n"); @@ -414,14 +430,12 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: service-type\n"); sb.append(" in: path\n"); sb.append( " description: Value defined by orchestration to identify this service.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __SERVICE-TYPE__\n"); sb.append(" - name: body\n"); sb.append(" in: body\n"); sb.append( @@ -465,14 +479,12 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: service-type\n"); sb.append(" in: path\n"); sb.append( " description: Value defined by orchestration to identify this service.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __SERVICE-TYPE__\n"); sb.append(" - name: body\n"); sb.append(" in: body\n"); sb.append(" description: service-subscription object that needs to be updated."); @@ -503,14 +515,12 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: service-type\n"); sb.append(" in: path\n"); sb.append( " description: Value defined by orchestration to identify this service.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __SERVICE-TYPE__\n"); sb.append(" - name: resource-version\n"); sb.append(" in: query\n"); sb.append(" description: resource-version for concurrency\n"); @@ -539,10 +549,8 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: service-type\n"); sb.append(" in: query\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"); @@ -568,7 +576,6 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" put:\n"); sb.append(" tags:\n"); sb.append(" - Business\n"); @@ -594,7 +601,6 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: body\n"); sb.append(" in: body\n"); sb.append( @@ -637,7 +643,6 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: body\n"); sb.append(" in: body\n"); sb.append(" description: customer object that needs to be updated."); @@ -666,7 +671,6 @@ public class YAMLfromOXMTest { " description: Global customer id used across to uniquely identify customer.\n"); sb.append(" required: true\n"); sb.append(" type: string\n"); - sb.append(" example: __GLOBAL-CUSTOMER-ID__\n"); sb.append(" - name: resource-version\n"); sb.append(" in: query\n"); sb.append(" description: resource-version for concurrency\n"); @@ -691,17 +695,14 @@ public class YAMLfromOXMTest { sb.append(" null parameters:\n"); sb.append(" - name: global-customer-id\n"); sb.append(" in: query\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/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/a\n"); sb.append(" required: false\n"); sb.append(" type: string\n"); return sb.toString(); |