diff options
author | James Forsyth <jf2512@att.com> | 2019-08-05 13:25:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-05 13:25:15 +0000 |
commit | 127b1c09eb66ff7f9273e1e79d283e94bd731b14 (patch) | |
tree | d4df68de7e204d633f6bb567bb1d19ce2b6eb060 /aai-schema-gen | |
parent | 7d3e532f6b3120996b78da36ef859028de8b9818 (diff) | |
parent | 21b104df3c85d99917719768323c1745e2607f49 (diff) |
Merge "Replace relationship array with object in generated swagger"
Diffstat (limited to 'aai-schema-gen')
5 files changed, 244 insertions, 124 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 e28c127..a491872 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 @@ -175,10 +175,38 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { if (namespaceFilter != null && (!namespaceFilter.contains(entry.getKey()))) { continue; } + logger.debug( + "Key: " + entry.getKey() + "Test: " + (entry.getKey() == "relationship-dict")); + if (entry.getKey().matches("relationship-dict")) { + String jb = entry.getValue(); + logger.debug("Value: " + jb); + int ndx = jb.indexOf("related-to-property:"); + if (ndx > 0) { + jb = jb.substring(0, ndx); + jb = jb.replaceAll(" +$", ""); + } + logger.debug("Value-after: " + jb); + sb.append(jb); + continue; + } sb.append(entry.getValue()); } return sb.toString(); } + + private String getDictionary(String resource) { + StringBuffer dictSb = new StringBuffer(); + dictSb.append(" " + resource + ":\n"); + dictSb.append(" description: |\n"); + dictSb.append(" dictionary of " + resource + "\n"); + dictSb.append(" type: object\n"); + dictSb.append(" properties:\n"); + dictSb.append(" " + resource + ":\n"); + dictSb.append(" type: array\n"); + dictSb.append(" items:\n"); + dictSb.append(" $ref: \"#/definitions/" + resource + "-dict\"\n"); + return dictSb.toString(); + } private String processJavaTypeElementSwagger(String javaTypeName, Element javaTypeElement, StringBuffer pathSb, StringBuffer definitionsSb, String path, String tag, String opId, @@ -304,6 +332,7 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { // pathParams.toString())+sbParameters.toString()); //cp8128 don't append the pathParams // to sbParameters so that child nodes don't contain the parameters from parent StringBuffer newPathParams = new StringBuffer(sbParameters.toString()); + String useName; for (int k = 0; addTypeV != null && k < addTypeV.size(); ++k) { String addType = addTypeV.elementAt(k); namespaceFilter.add(getXmlRootElementName(addType)); @@ -324,9 +353,15 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { } else if (getItemName == null) { ++propertyCnt; sbProperties.append(" " + getXmlRootElementName(addType) + ":\n"); - sbProperties.append(" type: array\n items:\n"); - sbProperties.append(" $ref: \"#/definitions/" + if ( "RelationshipList".equals(addType)) { + sbProperties.append(" type: object\n"); + sbProperties.append(" $ref: \"#/definitions/" + + itemName + "\"\n"); + } else { + sbProperties.append(" type: array\n items:\n"); + sbProperties.append(" $ref: \"#/definitions/" + (itemName == "" ? "aai-internal" : itemName) + "\"\n"); + } if (StringUtils.isNotEmpty(elementDescription)) { sbProperties .append(" description: " + elementDescription + "\n"); @@ -347,10 +382,16 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { processJavaTypeElementSwagger(addType, getJavaTypeElementSwagger(addType), pathSb, definitionsSb, path, tag == null ? useTag : tag, useOpId, null, newPathParams, validEdges); - sbProperties.append(" " + getXmlRootElementName(addType) + ":\n"); - sbProperties.append(" type: array\n items: \n"); - sbProperties.append(" $ref: \"#/definitions/" - + getXmlRootElementName(addType) + "\"\n"); + useName = getXmlRootElementName(addType); + sbProperties.append(" " + useName + ":\n"); + if ( "relationship".equals(useName)) { + sbProperties.append(" type: object\n"); + sbProperties.append(" $ref: \"#/definitions/relationship\"\n"); + } else { + sbProperties.append(" type: array\n items: \n"); + sbProperties.append(" $ref: \"#/definitions/" + + getXmlRootElementName(addType) + "\"\n"); + } if (StringUtils.isNotEmpty(elementDescription)) { sbProperties .append(" description: " + elementDescription + "\n"); @@ -403,6 +444,7 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { return null; } boolean processingInventoryDef = false; + String dict = null; if (xmlRootElementName.equals("inventory")) { // inventory properties for each oxm to be concatenated processingInventoryDef = true; @@ -412,7 +454,10 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { definitionsLocalSb.append(" " + xmlRootElementName + ":\n"); definitionsLocalSb.append(" properties:\n"); } - + } else if (xmlRootElementName.equals("relationship")) { + definitionsSb.append(" " + "relationship-dict" + ":\n"); + definitionsLocalSb.append(" " + "relationship-dict" + ":\n"); + dict = getDictionary(xmlRootElementName); } else { definitionsSb.append(" " + xmlRootElementName + ":\n"); definitionsLocalSb.append(" " + xmlRootElementName + ":\n"); @@ -539,6 +584,10 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { if (xmlRootElementName.equals("inventory")) { // will add to javaTypeDefinitions at end inventoryDefSb.append(definitionsLocalSb.toString()); + } else if (xmlRootElementName.equals("relationship")) { + javaTypeDefinitions.put(xmlRootElementName, dict); + javaTypeDefinitions.put(xmlRootElementName + "-dict", + definitionsLocalSb.toString()); } else { javaTypeDefinitions.put(xmlRootElementName, definitionsLocalSb.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 45e2ea3..ee5fa36 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 @@ -319,7 +319,7 @@ public class YAMLfromOXM extends OxmFileProcessor { + appliedPaths.containsKey(path)); appliedPaths.put(path, xmlRootElementName); } - + Vector<String> addTypeV = null; for (int i = 0; i < xmlElementNodes.getLength(); ++i) { XSDElement xmlElementElement = new XSDElement((Element) xmlElementNodes.item(i)); @@ -367,6 +367,7 @@ public class YAMLfromOXM extends OxmFileProcessor { StringBuffer newPathParams = new StringBuffer( (pathParams == null ? "" : pathParams.toString()) + sbParameters.toString()); + String useName; for (int k = 0; addTypeV != null && k < addTypeV.size(); ++k) { String addType = addTypeV.elementAt(k); namespaceFilter.add(getXmlRootElementName(addType)); @@ -389,9 +390,18 @@ public class YAMLfromOXM extends OxmFileProcessor { } else if (getItemName == null) { ++propertyCnt; sbProperties.append(" " + getXmlRootElementName(addType) + ":\n"); - sbProperties.append(" type: array\n items:\n"); - sbProperties.append(" $ref: \"#/definitions/" + if ( "RelationshipList".equals(addType)) { + sbProperties.append(" type: object\n"); + sbProperties.append(" $ref: \"#/definitions/" + + itemName + "\"\n"); + } else { + if ( "relationship".equals(itemName) ) { + System.out.println(v + "-relationship added as array for getItemName null"); + } + sbProperties.append(" type: array\n items:\n"); + sbProperties.append(" $ref: \"#/definitions/" + (itemName == "" ? "inventory-item-data" : itemName) + "\"\n"); + } if (StringUtils.isNotEmpty(elementDescription)) { sbProperties .append(" description: " + elementDescription + "\n"); @@ -408,13 +418,19 @@ public class YAMLfromOXM extends OxmFileProcessor { processJavaTypeElementSwagger(addType, getJavaTypeElementSwagger(addType), pathSb, definitionsSb, path, tag == null ? useTag : tag, useOpId, null, newPathParams, validEdges); - sbProperties.append(" " + getXmlRootElementName(addType) + ":\n"); - sbProperties.append(" type: array\n items: \n"); - sbProperties.append(" $ref: \"#/definitions/" - + getXmlRootElementName(addType) + "\"\n"); - if (StringUtils.isNotEmpty(elementDescription)) { - sbProperties - .append(" description: " + elementDescription + "\n"); + useName = getXmlRootElementName(addType); + sbProperties.append(" " + useName + ":\n"); + if ( "relationship".equals(useName)) { + sbProperties.append(" type: object\n"); + sbProperties.append(" $ref: \"#/definitions/relationship\"\n"); + } else { + sbProperties.append(" type: array\n items: \n"); + sbProperties.append(" $ref: \"#/definitions/" + + getXmlRootElementName(addType) + "\"\n"); + if (StringUtils.isNotEmpty(elementDescription)) { + sbProperties + .append(" description: " + elementDescription + "\n"); + } } } else { 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 f926b40..eb2ce81 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 @@ -250,37 +250,32 @@ public class NodesYAMLfromOXMTest { } public String YAMLheader() { StringBuilder sb = new StringBuilder(1500); - sb.append("swagger: \"2.0\"\n"); - sb.append("info:\n"); - sb.append(" description: |\n"); - sb.append("\n"); - sb.append(" [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)\n"); - sb.append("\n"); - sb.append(" Copyright © 2017-18 AT&T Intellectual Property. All rights reserved.\n"); - sb.append("\n"); - 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.\n"); - sb.append("\n"); - sb.append(" You may obtain a copy of the License at\n"); - sb.append("\n"); - sb.append(" (https://creativecommons.org/licenses/by/4.0/)\n"); - sb.append("\n"); - 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.\n"); - sb.append("\n"); - sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions.\n"); - sb.append(" version: \"v11\"\n"); - sb.append(" title: Active and Available Inventory REST API\n"); - sb.append(" license:\n"); - sb.append(" name: Apache 2.0\n"); - sb.append(" url: http://www.apache.org/licenses/LICENSE-2.0.html\n"); - sb.append(" contact:\n"); - sb.append(" name:\n"); - sb.append(" url:\n"); - sb.append(" email:\n"); - sb.append("host:\n"); - sb.append("basePath: /aai/v11\n"); - sb.append("schemes:\n"); - sb.append(" - https\n"); - sb.append("paths:\n"); + 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_swagger_v11.diff)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR); + sb.append(" Copyright © 2017-18 AT&T Intellectual Property. All rights reserved.\n\n"); + 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.\n\n"); + sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" version: \"v11\"" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" title: Active and Available Inventory REST API" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" license:" + OxmFileProcessor.LINE_SEPARATOR); + 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("basePath: /aai/v11" + OxmFileProcessor.LINE_SEPARATOR); + sb.append("schemes:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" - https\n"); + sb.append("paths:" + OxmFileProcessor.LINE_SEPARATOR); return sb.toString(); } @@ -440,12 +435,12 @@ public class NodesYAMLfromOXMTest { sb.append(" business:\n"); sb.append(" type: object\n"); sb.append(" $ref: \"#/definitions/business\"\n"); - sb.append(" nodes:\n"); - sb.append(" properties:\n"); - sb.append(" inventory-item-data:\n"); - sb.append(" type: array\n"); - sb.append(" items:\n"); - sb.append(" $ref: \"#/definitions/inventory-item-data\"\n"); + sb.append(" nodes:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" properties:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" inventory-item-data:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" type: array" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" items:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" $ref: \"#/definitions/inventory-item-data\"" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" service-subscription:\n"); sb.append(" description: |\n"); sb.append(" Object that group service instances.\n"); @@ -523,12 +518,12 @@ public class NodesYAMLfromOXMTest { sb.append(" business:\n"); sb.append(" type: object\n"); sb.append(" $ref: \"#/patchDefinitions/business\"\n"); - sb.append(" nodes:\n"); - sb.append(" properties:\n"); - sb.append(" inventory-item-data:\n"); - sb.append(" type: array\n"); - sb.append(" items:\n"); - sb.append(" $ref: \"#/patchDefinitions/inventory-item-data\"\n"); + sb.append(" nodes:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" properties:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" inventory-item-data:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" type: array" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" items:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" $ref: \"#/patchDefinitions/inventory-item-data\"" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" service-subscription:\n"); sb.append(" description: |\n"); sb.append(" Object that group service instances.\n"); @@ -610,12 +605,12 @@ public class NodesYAMLfromOXMTest { sb.append(" business:\n"); sb.append(" type: object\n"); sb.append(" $ref: \"#/definitions/business\"\n"); - sb.append(" nodes:\n"); - sb.append(" properties:\n"); - sb.append(" inventory-item-data:\n"); - sb.append(" type: array\n"); - sb.append(" items:\n"); - sb.append(" $ref: \"#/definitions/inventory-item-data\"\n"); + sb.append(" nodes:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" properties:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" inventory-item-data:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" type: array" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" items:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" $ref: \"#/definitions/inventory-item-data\"" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" service-subscription:\n"); sb.append(" description: |\n"); sb.append(" Object that group service instances.\n"); 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 a9c7880..6b21dfd 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 @@ -81,7 +81,19 @@ public class XSDElementTest { addEndOfXML(sb); testXML = sb.toString(); init(); -} + } + + public void setUpRelationship( ) throws Exception { + StringBuilder sb = new StringBuilder(maxSizeForXml); + addNamespaceNoInventory(sb); + addRelationship(sb); + addRelationshipList(sb); + addRelatedToProperty(sb); + addRelationshipData(sb); + addEndOfXML(sb); + testXML = sb.toString(); + init(); + } private void addNamespace(StringBuilder sb){ sb.append("<xml-bindings xmlns=\"http://www.eclipse.org/eclipselink/xsds/persistence/oxm\" package-name=\"inventory.aai.onap.org.v11\" xml-mapping-metadata-complete=\"true\">\n"); @@ -96,6 +108,14 @@ public class XSDElementTest { sb.append("</java-attributes>\n"); sb.append("</java-type>\n"); } + + private void addNamespaceNoInventory(StringBuilder sb){ + sb.append("<xml-bindings xmlns=\"http://www.eclipse.org/eclipselink/xsds/persistence/oxm\" package-name=\"inventory.aai.onap.org.v11\" xml-mapping-metadata-complete=\"true\">\n"); + sb.append("<xml-schema element-form-default=\"QUALIFIED\">\n"); + sb.append("<xml-ns namespace-uri=\"http://org.onap.aai.inventory/v11\" />\n"); + sb.append("</xml-schema>\n"); + sb.append("<java-types>\n"); + } private void addBusiness(StringBuilder sb){ sb.append("<java-type name=\"Business\">\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 7246870..7f746ec 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 @@ -57,6 +57,7 @@ import java.util.TreeSet; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @@ -99,29 +100,41 @@ public class YAMLfromOXMTest { System.setProperty("AJSC_HOME", "."); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local"); System.setProperty("aai.service.name", SERVICE_NAME); + } + + - XSDElementTest x = new XSDElementTest(); - x.setUp(); - testXML = x.testXML; - logger.debug(testXML); - BufferedWriter bw = new BufferedWriter(new FileWriter(OXMFILENAME)); - bw.write(testXML); - bw.close(); - BufferedWriter bw1 = new BufferedWriter(new FileWriter(EDGEFILENAME)); - bw1.write(EdgeDefs()); - bw1.close(); - + @Before + public void setUp() throws Exception { + XSDElementTest x = new XSDElementTest(); + x.setUp(); + testXML = x.testXML; + logger.debug(testXML); + BufferedWriter bw = new BufferedWriter(new FileWriter(OXMFILENAME)); + bw.write(testXML); + bw.close(); + BufferedWriter bw1 = new BufferedWriter(new FileWriter(EDGEFILENAME)); + bw1.write(EdgeDefs()); + bw1.close(); + } + + public void setupRelationship() throws Exception{ + XSDElementTest x = new XSDElementTest(); + x.setUpRelationship(); + testXML = x.testXML; + logger.debug(testXML); + BufferedWriter bw = new BufferedWriter(new FileWriter(OXMFILENAME)); + bw.write(testXML); + bw.close(); + BufferedWriter bw1 = new BufferedWriter(new FileWriter(EDGEFILENAME)); + bw1.write(EdgeDefs()); + bw1.close(); } - @Before - public void setUp() throws Exception { - - } - @Test public void AtestIngestors() throws EdgeRuleNotFoundException { Multimap<String, EdgeRule> results = edgeIngestor.getAllRules(schemaVersions.getDefaultVersion()); @@ -162,7 +175,6 @@ public class YAMLfromOXMTest { assertThat("FileContent-TestProcess:\n"+fileContent,fileContent, is(YAMLresult())); } - @Test public void testYAMLfromOXMFileVersionFile() throws IOException { String outfileName = "testXML.xml"; @@ -200,6 +212,27 @@ public class YAMLfromOXMTest { } assertThat("FileContent-OXMStringVersionFile:\n"+fileContent,fileContent, is(YAMLresult())); } + + @Test + public void testRelationshipListYAMLfromOXMStringVersionFile() { + try { + setupRelationship(); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + SchemaVersion v = schemaVersions.getAppRootVersion(); + String apiVersion = v.toString(); + String fileContent = null; + try { + yamlFromOxm.setXmlVersion(testXML, v); + fileContent = yamlFromOxm.process(); + } catch(Exception e) { + e.printStackTrace(); + } + boolean matchFound = fileContent.contains(( YAMLRelationshipList())); + assertTrue("RelationshipListFormat:\n", matchFound); + } @Test public void testAppendDefinitions() { @@ -278,36 +311,33 @@ public class YAMLfromOXMTest { public String YAMLheader() { StringBuilder sb = new StringBuilder(1500); sb.append("swagger: \"2.0\"\n"); - sb.append("info:\n"); + sb.append("info:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" description: |\n"); sb.append("\n"); - sb.append(" [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)\n"); - sb.append("\n"); - sb.append(" Copyright © 2017-18 AT&T Intellectual Property. All rights reserved.\n"); - sb.append("\n"); + sb.append(" [Differences versus the previous schema version](apidocs/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.\n"); sb.append("\n"); sb.append(" You may obtain a copy of the License at\n"); sb.append("\n"); sb.append(" (https://creativecommons.org/licenses/by/4.0/)\n"); sb.append("\n"); - 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.\n"); - sb.append("\n"); - sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions.\n"); - sb.append(" version: \"v11\"\n"); - sb.append(" title: Active and Available Inventory REST API\n"); - sb.append(" license:\n"); + 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 appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" version: \"v11\"" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" title: Active and Available Inventory REST API" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" license:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" name: Apache 2.0\n"); - sb.append(" url: http://www.apache.org/licenses/LICENSE-2.0.html\n"); - sb.append(" contact:\n"); - sb.append(" name:\n"); - sb.append(" url:\n"); - sb.append(" email:\n"); - sb.append("host:\n"); - sb.append("basePath: /aai/v11\n"); - sb.append("schemes:\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("basePath: /aai/v11" + OxmFileProcessor.LINE_SEPARATOR); + sb.append("schemes:" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" - https\n"); - sb.append("paths:\n"); + sb.append("paths:" + OxmFileProcessor.LINE_SEPARATOR); return sb.toString(); } @@ -681,12 +711,12 @@ public class YAMLfromOXMTest { sb.append(" business:\n"); sb.append(" type: object\n"); sb.append(" $ref: \"#/definitions/business\"\n"); - sb.append(" nodes:\n"); - sb.append(" properties:\n"); - sb.append(" inventory-item-data:\n"); - sb.append(" type: array\n"); - sb.append(" items:\n"); - sb.append(" $ref: \"#/definitions/inventory-item-data\"\n"); + sb.append(" nodes:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" properties:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" inventory-item-data:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" type: array" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" items:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" $ref: \"#/definitions/inventory-item-data\"" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" service-subscription:\n"); sb.append(" description: |\n"); sb.append(" Object that group service instances.\n"); @@ -764,12 +794,12 @@ public class YAMLfromOXMTest { sb.append(" business:\n"); sb.append(" type: object\n"); sb.append(" $ref: \"#/patchDefinitions/business\"\n"); - sb.append(" nodes:\n"); - sb.append(" properties:\n"); - sb.append(" inventory-item-data:\n"); - sb.append(" type: array\n"); - sb.append(" items:\n"); - sb.append(" $ref: \"#/patchDefinitions/inventory-item-data\"\n"); + sb.append(" nodes:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" properties:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" inventory-item-data:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" type: array" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" items:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" $ref: \"#/patchDefinitions/inventory-item-data\"" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" service-subscription:\n"); sb.append(" description: |\n"); sb.append(" Object that group service instances.\n"); @@ -851,12 +881,12 @@ public class YAMLfromOXMTest { sb.append(" business:\n"); sb.append(" type: object\n"); sb.append(" $ref: \"#/getDefinitions/business\"\n"); - sb.append(" nodes:\n"); - sb.append(" properties:\n"); - sb.append(" inventory-item-data:\n"); - sb.append(" type: array\n"); - sb.append(" items:\n"); - sb.append(" $ref: \"#/getDefinitions/inventory-item-data\"\n"); + sb.append(" nodes:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" properties:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" inventory-item-data:" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" type: array" + OxmFileProcessor.LINE_SEPARATOR); + sb.append(" items:" + OxmFileProcessor.LINE_SEPARATOR ); + sb.append(" $ref: \"#/getDefinitions/inventory-item-data\"" + OxmFileProcessor.LINE_SEPARATOR); sb.append(" service-subscription:\n"); sb.append(" description: |\n"); sb.append(" Object that group service instances.\n"); @@ -889,6 +919,17 @@ public class YAMLfromOXMTest { sb.append(" $ref: \"#/getDefinitions/service-subscription\"\n"); return sb.toString(); } + + public String YAMLRelationshipList() { + StringBuilder sb = new StringBuilder(8092); + sb.append(" relationship-list:\n"); + sb.append(" properties:\n"); + sb.append(" relationship:\n"); + sb.append(" type: object\n"); + sb.append(" $ref: \"#/getDefinitions/relationship\"\n"); + return sb.toString(); + } + public static String EdgeDefs() { StringBuilder sb = new StringBuilder(8092); sb.append("{\n" + @@ -933,5 +974,4 @@ public class YAMLfromOXMTest { "}\n"); return sb.toString(); } -} - +}
\ No newline at end of file |