summaryrefslogtreecommitdiffstats
path: root/aai-schema-gen/src
diff options
context:
space:
mode:
Diffstat (limited to 'aai-schema-gen/src')
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java12
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java9
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java2
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java50
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java16
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java6
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java6
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java16
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java14
9 files changed, 92 insertions, 39 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 9ff0fa3..e75be8f 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
@@ -87,8 +87,12 @@ public class NodesYAMLfromOXM extends OxmFileProcessor {
+ "apidocs/aai_swagger_" + v.toString() + ".diff)");
}
sb.append(
- DOUBLE_LINE_SEPARATOR + " Copyright © 2017-18 AT&T Intellectual Property. All rights reserved.\n\n Licensed under the Creative Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except in compliance with the License." + DOUBLE_LINE_SEPARATOR + " You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)" + DOUBLE_LINE_SEPARATOR + " 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 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." + LINE_SEPARATOR + " version: \""
- + v.toString() + "\"" + LINE_SEPARATOR );
+ DOUBLE_LINE_SEPARATOR + " Copyright © 2017-18 AT&T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR + " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except in compliance with the License." + DOUBLE_LINE_SEPARATOR + " You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)" + DOUBLE_LINE_SEPARATOR + " 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 + " 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. ");
+ sb.append(
+ "Edge definitions can be found with the node definitions." + LINE_SEPARATOR + " version: \""
+ + v.toString() + "\"" + LINE_SEPARATOR );
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);
@@ -257,6 +261,7 @@ public class NodesYAMLfromOXM extends OxmFileProcessor {
String pathDescriptionProperty = javaType.getPathDescriptionProperty();
String container = javaType.getContainerProperty();
Vector<String> indexedProps = javaType.getIndexedProps();
+ Vector<String> dslStartNodeProps = javaType.getDslStartNodeProps();
Vector<String> containerProps = new Vector<String>();
if (container != null) {
logger.debug("javaTypeName " + javaTypeName + " container:" + container
@@ -324,7 +329,8 @@ public class NodesYAMLfromOXM extends OxmFileProcessor {
NodeGetOperation.addContainerProps(container, containerProps);
}
if (xmlElementElement.isStandardType()) {
- sbProperties.append(xmlElementElement.getTypePropertyYAML());
+ boolean isDslStartNode = dslStartNodeProps.contains(xmlElementElement.getAttribute("name"));
+ sbProperties.append(xmlElementElement.getTypePropertyYAML(isDslStartNode));
++propertyCnt;
}
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java
index 5ab3678..496f3df 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java
@@ -20,6 +20,7 @@
package org.onap.aai.schemagen.genxsd;
import org.apache.commons.lang3.StringUtils;
+import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.schemagen.GenerateXsd;
import java.util.StringTokenizer;
@@ -31,8 +32,9 @@ public class PatchOperation {
private String path;
private String pathParams;
private String prefixForPatch;
+ private SchemaVersion version;
- public PatchOperation(String useOpId, String xmlRootElementName, String tag, String path, String pathParams) {
+ public PatchOperation(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, SchemaVersion v) {
super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
@@ -40,6 +42,7 @@ public class PatchOperation {
this.path = path;
this.pathParams = pathParams;
this.prefixForPatch = "";
+ this.version = v;
}
public void setPrefixForPatchRef(String prefixForPatchRef) {
this.prefixForPatch = prefixForPatchRef;
@@ -81,8 +84,8 @@ public class PatchOperation {
if ( path.endsWith("/relationship") ) {
pathSb.append(" summary: see node definition for valid relationships\n");
- relationshipExamplesSb.append("[See Examples](apidocs/relations/"+GenerateXsd.getAPIVersion()+"/"+useOpId+".json)");
} else {
+ relationshipExamplesSb.append("[See Examples](apidocs/relations/"+version.toString()+"/"+useOpId+".json)");
pathSb.append(" summary: update an existing " + xmlRootElementName + "\n");
pathSb.append(" description: |\n");
pathSb.append(" Update an existing " + xmlRootElementName + "\n");
@@ -109,7 +112,7 @@ public class PatchOperation {
pathSb.append(pathParams); // for nesting
pathSb.append(" - name: body\n");
pathSb.append(" in: body\n");
- pathSb.append(" description: " + xmlRootElementName + " object that needs to be updated."+relationshipExamplesSb.toString()+"\n");
+ pathSb.append(" description: " + xmlRootElementName + " object that needs to be updated."+relationshipExamplesSb.toString()+"\n");
pathSb.append(" required: true\n");
pathSb.append(" schema:\n");
pathSb.append(" $ref: \"#/definitions/" + prefixForPatch + xmlRootElementName + "\"\n");
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java
index c666d9f..2b3fcf2 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java
@@ -76,7 +76,7 @@ public class PutRelationPathSet {
relations.add("{\"comment\": \"Valid TO Relations that can be added\"}\n");
SortedSet<String> ss=new TreeSet<String>(results.keySet());
for(String key : ss) {
- results.get(key).stream().filter((i) -> (! i.isPrivateEdge())).forEach((i) ->{ String rel = selectedRelation(i); relations.add(rel); logger.debug("Relation added: "+rel); } );
+ results.get(key).stream().filter((i) -> ("NONE".equals(i.getContains()) &&! i.isPrivateEdge())).forEach((i) ->{ String rel = selectedRelation(i); relations.add(rel); logger.debug("Relation added: "+rel); } );
}
} catch(Exception e) {
logger.debug("objectName: "+objectName+"\n"+e);
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 38117e5..785ea68 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
@@ -37,6 +37,7 @@ public class XSDElement implements Element {
private static final int VALUE_INDEXED_PROPS = 2;
private static final int VALUE_CONTAINER = 3;
private static final int VALUE_REQUIRES = 4;
+ private static final int VALUE_DSLSTARTNODE = 5;
public XSDElement(Element xmlElementElement, String maxOccurs) {
super();
@@ -153,8 +154,9 @@ public class XSDElement implements Element {
}
return pathDescriptionProperty;
}
- public Vector<String> getIndexedProps() {
- Vector<String> indexedProps = new Vector<String>();
+
+ public Vector<String> getProps(int needValue) {
+ Vector<String> props = new Vector<String>();
NodeList xmlPropNodes = this.getElementsByTagName("xml-properties");
for ( int i = 0; i < xmlPropNodes.getLength(); ++i ) {
@@ -173,19 +175,21 @@ public class XSDElement implements Element {
String attrValue = attr.getNodeValue();
if ( attrName == null || attrValue == null )
continue;
- if ( attrValue.equals("indexedProps")) {
+ if ( needValue == VALUE_INDEXED_PROPS && attrValue.equals("indexedProps")) {
useValue = VALUE_INDEXED_PROPS;
+ } else if ( needValue == VALUE_DSLSTARTNODE && attrValue.equals("dslStartNodeProps")) {
+ useValue = VALUE_DSLSTARTNODE;
}
- if ( useValue == VALUE_INDEXED_PROPS && attrName.equals("value")) {
- indexedProps = getIndexedProps( attrValue );
+ if ( useValue != VALUE_NONE && attrName.equals("value")) {
+ props = getProps( attrValue );
}
}
}
}
- return indexedProps;
+ return props;
}
-
- private static Vector<String> getIndexedProps( String attrValue )
+
+ private static Vector<String> getProps( String attrValue )
{
if ( attrValue == null )
return null;
@@ -198,6 +202,14 @@ public class XSDElement implements Element {
}
return result;
}
+
+ public Vector<String> getIndexedProps() {
+ return getProps(VALUE_INDEXED_PROPS);
+ }
+
+ public Vector<String> getDslStartNodeProps() {
+ return getProps(VALUE_DSLSTARTNODE);
+ }
public String getContainerProperty() {
NodeList xmlPropNodes = this.getElementsByTagName("xml-properties");
@@ -407,7 +419,7 @@ public class XSDElement implements Element {
return sb.toString();
}
- public String getTypePropertyYAML() {
+ public String getTypePropertyYAML(boolean isDslStartNode) {
StringBuffer sbProperties = new StringBuffer();
sbProperties.append(" " + this.getAttribute("name") + ":\n");
sbProperties.append(" type: ");
@@ -425,8 +437,21 @@ public class XSDElement implements Element {
else if ( ("java.lang.Boolean").equals(this.getAttribute("type")))
sbProperties.append("boolean\n");
String attrDescription = this.getPathDescriptionProperty();
- if ( attrDescription != null && attrDescription.length() > 0 )
- sbProperties.append(" description: " + attrDescription + "\n");
+ if ( attrDescription != null && attrDescription.length() > 0 ) {
+ if ( !isDslStartNode ) {
+ sbProperties.append(" description: " + attrDescription + "\n");
+ } else {
+ sbProperties.append(" description: |\n");
+ sbProperties.append(" " + attrDescription + "\n");
+ sbProperties.append(" *This property can be used as a filter to find the start node for a dsl query\n");
+ }
+ } else {
+ if ( isDslStartNode ) {
+ sbProperties.append(" description: |\n");
+ sbProperties.append(" \n");
+ sbProperties.append(" *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: " + elementAlsoRequiresProperty + "\n");
@@ -735,5 +760,4 @@ public class XSDElement implements Element {
}
-}
-
+} \ No newline at end of file
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 b75a1dc..40d5c0e 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
@@ -88,8 +88,12 @@ public class YAMLfromOXM extends OxmFileProcessor {
+ "apidocs/aai_swagger_" + v.toString() + ".diff)");
}
sb.append(
- DOUBLE_LINE_SEPARATOR + " Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + DOUBLE_LINE_SEPARATOR + " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License.\n\n You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)\n\n Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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." + DOUBLE_LINE_SEPARATOR + " 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." + LINE_SEPARATOR + " version: \""
- + v.toString() + "\"" + LINE_SEPARATOR );
+ DOUBLE_LINE_SEPARATOR + " Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR + " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License." + DOUBLE_LINE_SEPARATOR + " You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)" + DOUBLE_LINE_SEPARATOR + " Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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 + " 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. ");
+ sb.append(
+ "Edge definitions can be found with the node definitions." + LINE_SEPARATOR + " version: \""
+ + v.toString() + "\"" + LINE_SEPARATOR );
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);
@@ -264,6 +268,7 @@ public class YAMLfromOXM extends OxmFileProcessor {
String pathDescriptionProperty = javaType.getPathDescriptionProperty();
String container = javaType.getContainerProperty();
Vector<String> indexedProps = javaType.getIndexedProps();
+ Vector<String> dslStartNodeProps = javaType.getDslStartNodeProps();
Vector<String> containerProps = new Vector<String>();
if (container != null) {
logger.debug("javaTypeName " + javaTypeName + " container:" + container
@@ -345,9 +350,10 @@ public class YAMLfromOXM extends OxmFileProcessor {
GetOperation.addContainerProps(container, containerProps);
}
if (xmlElementElement.isStandardType()) {
- sbProperties.append(xmlElementElement.getTypePropertyYAML());
+ boolean isDslStartNode = dslStartNodeProps.contains(xmlElementElement.getAttribute("name"));
+ sbProperties.append(xmlElementElement.getTypePropertyYAML(isDslStartNode));
if ( !"resource-version".equals(xmlElementElement.getAttribute("name"))) {
- sbPropertiesPatch.append(xmlElementElement.getTypePropertyYAML());
+ sbPropertiesPatch.append(xmlElementElement.getTypePropertyYAML(isDslStartNode));
++patchPropertyCnt;
}
++propertyCnt;
@@ -464,7 +470,7 @@ public class YAMLfromOXM extends OxmFileProcessor {
pathSb.append(put.toString());
// add PATCH
PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path,
- pathParams == null ? "" : pathParams.toString());
+ pathParams == null ? "" : pathParams.toString(), this.v);
patch.setPrefixForPatchRef(patchDefinePrefix);
pathSb.append(patch.toString());
// add DELETE
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 d08c3e0..9ad16d6 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
@@ -253,13 +253,13 @@ public class NodesYAMLfromOXMTest {
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 &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved.\n\n");
+ sb.append(" Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); 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 &quot;AS IS&quot; 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(" Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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);
sb.append(" title: Active and Available Inventory REST API" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" license:" + OxmFileProcessor.LINE_SEPARATOR);
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
index e686fbc..e36d520 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import org.onap.aai.setup.SchemaVersion;
import java.util.Arrays;
import java.util.Collection;
@@ -39,11 +40,12 @@ public class PatchOperationTest {
private String path;
private String pathParams;
private String result;
+ private static SchemaVersion v = new SchemaVersion("v16");
@Parameters
public static Collection<String []> testConditions() {
String inputs [][] = {
- {"NetworkGenericVnfsGenericVnf","generic-vnf","Network","/network/generic-vnfs/generic-vnf/{vnf-id}"," - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__"," patch:\n tags:\n - Network\n summary: update an existing generic-vnf\n description: |\n Update an existing generic-vnf\n #\n Note: Endpoints that are not devoted to object relationships support both PUT and PATCH operations.\n The PUT operation will entirely replace an existing object.\n The PATCH operation sends a \"description of changes\" for an existing object. The entire set of changes must be applied. An error result means no change occurs.\n #\n Other differences between PUT and PATCH are:\n #\n - For PATCH, you can send any of the values shown in sample REQUEST body. There are no required values.\n - For PATCH, resource-id which is a required REQUEST body element for PUT, must not be sent.\n - PATCH cannot be used to update relationship elements; there are dedicated PUT operations for this.\n operationId: UpdateNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n produces:\n - application/json\n responses:\n \"default\":\n null parameters:\n - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__ - name: body\n in: body\n description: generic-vnf object that needs to be updated.\n required: true\n schema:\n $ref: \"#/definitions/generic-vnf\"\n"},
+ {"NetworkGenericVnfsGenericVnf","generic-vnf","Network","/network/generic-vnfs/generic-vnf/{vnf-id}"," - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__"," patch:\n tags:\n - Network\n summary: update an existing generic-vnf\n description: |\n Update an existing generic-vnf\n #\n Note: Endpoints that are not devoted to object relationships support both PUT and PATCH operations.\n The PUT operation will entirely replace an existing object.\n The PATCH operation sends a \"description of changes\" for an existing object. The entire set of changes must be applied. An error result means no change occurs.\n #\n Other differences between PUT and PATCH are:\n #\n - For PATCH, you can send any of the values shown in sample REQUEST body. There are no required values.\n - For PATCH, resource-id which is a required REQUEST body element for PUT, must not be sent.\n - PATCH cannot be used to update relationship elements; there are dedicated PUT operations for this.\n operationId: UpdateNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n produces:\n - application/json\n responses:\n \"default\":\n null parameters:\n - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__ - name: body\n in: body\n description: generic-vnf object that needs to be updated.[See Examples](apidocs/relations/v16/NetworkGenericVnfsGenericVnf.json)\n required: true\n schema:\n $ref: \"#/definitions/generic-vnf\"\n"},
// if ( StringUtils.isEmpty(tag) )
{"GenericVnf","generic-vnf","","/generic-vnf/{vnf-id}"," - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__",""},
// Test: if ( !path.endsWith("/relationship") && !path.endsWith("}") )
@@ -73,7 +75,7 @@ public class PatchOperationTest {
@Test
public void testToString() {
- PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams);
+ PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams, v);
String modResult = patch.toString();
assertThat(modResult, is(this.result));
}
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 3c072f3..2ebaee1 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
@@ -43,6 +43,7 @@ import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.collection.IsIn.in;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.hamcrest.core.Every.everyItem;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
public class XSDElementTest {
@@ -603,13 +604,23 @@ public class XSDElementTest {
target.add(" Customer:\n type: description: customer identifiers to provide linkage back to BSS information.\n");
target.add(" ServiceSubscriptions:\n type: description: Collection of objects that group service instances.\n");
target.add(" ServiceSubscription:\n type: description: Object that group service instances.\n");
+ StringBuilder sb = new StringBuilder(" Customer:\n type: description: |\n customer identifiers to provide linkage back to BSS information.\n");
+ sb.append(" *This property can be used as a filter to find the start node for a dsl query\n");
+ String yamlDesc = sb.toString();
List<String> types = new ArrayList<String>();
+ String container;
+ String customerDesc = null;
for ( int i = 0; i < javaTypeNodes.getLength(); ++ i ) {
XSDElement javaTypeElement = new XSDElement((Element) javaTypeNodes.item(i));
- if(javaTypeElement.getTypePropertyYAML() != null)
- types.add(javaTypeElement.getTypePropertyYAML());
+ if(javaTypeElement.getTypePropertyYAML(false) != null)
+ types.add(javaTypeElement.getTypePropertyYAML(false));
+ container = javaTypeElement.getContainerProperty();
+ if ( "customers".equals(container)) {
+ customerDesc = javaTypeElement.getTypePropertyYAML(true);
+ }
}
assertThat(new ArrayList<>(types),both(everyItem(is(in(target.toArray())))).and(containsInAnyOrder(target.toArray())));
+ assertEquals(customerDesc, yamlDesc );
}
@Test
@@ -640,4 +651,5 @@ public class XSDElementTest {
}
}
+
}
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 b54408d..2ccf051 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
@@ -315,14 +315,12 @@ public class YAMLfromOXMTest {
sb.append("\n");
sb.append(" [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License.\n");
- sb.append("\n");
+ sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); 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/)\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 &quot;AS IS&quot; 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(" 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);
sb.append(" title: Active and Available Inventory REST API" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" license:" + OxmFileProcessor.LINE_SEPARATOR);
@@ -445,7 +443,8 @@ public class YAMLfromOXMTest {
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.\n");
+ sb.append(" description: service-subscription object that needs to be updated.");
+ sb.append("[See Examples](apidocs/relations/v11/BusinessCustomersCustomerServiceSubscriptionsServiceSubscription.json)\n");
sb.append(" required: true\n");
sb.append(" schema:\n");
sb.append(" $ref: \"#/definitions/zzzz-patch-service-subscription\"\n");
@@ -594,7 +593,8 @@ public class YAMLfromOXMTest {
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.\n");
+ sb.append(" description: customer object that needs to be updated.");
+ sb.append("[See Examples](apidocs/relations/v11/BusinessCustomersCustomer.json)\n");
sb.append(" required: true\n");
sb.append(" schema:\n");
sb.append(" $ref: \"#/definitions/zzzz-patch-customer\"\n");