diff options
author | LaMont, William(wl2432) <wl2432@att.com> | 2020-06-12 13:35:23 -0400 |
---|---|---|
committer | LaMont, William(wl2432) <wl2432@att.com> | 2020-06-18 16:09:01 -0400 |
commit | a8ce62a3bae5976982f6d1432723251a414e2878 (patch) | |
tree | 1f03bc2c46e35e45a954a3396a492dba79a8d6d2 /aai-schema-gen/src | |
parent | decb7c92edf67ba67facb7d20d0c8f66d08a46d0 (diff) |
v20 support in schema-service without javafx
Issue-ID: AAI-2930
Change-Id: I68ba45069f465988e21602521e8e665cb27318d1
Signed-off-by: LaMont, William(wl2432) <wl2432@att.com>
Diffstat (limited to 'aai-schema-gen/src')
9 files changed, 25 insertions, 26 deletions
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java index 2af0662..35f0665 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java @@ -271,13 +271,6 @@ public class HTMLfromOXM extends OxmFileProcessor { } private boolean versionUsesAnnotations( String version) { - int ver = new Integer(version.substring(1)).intValue(); - if ( ver >= HTMLfromOXM.annotationsStartVersion ) { - return true; - } - if ( ver <= HTMLfromOXM.annotationsMinVersion ) { - return true; - } - return false; + return true; } } 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 e75be8f..1de4466 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 @@ -84,7 +84,7 @@ public class NodesYAMLfromOXM extends OxmFileProcessor { sb.append("description: |"); if (versionSupportsSwaggerDiff(v.toString())) { sb.append("\n\n [Differences versus the previous schema version](" - + "apidocs/aai_swagger_" + v.toString() + ".diff)"); + +"apidocs" + basePath + "/aai_swagger_" + v.toString() + ".diff)"); } sb.append( 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. "); 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 496f3df..dc762ee 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 @@ -33,8 +33,10 @@ public class PatchOperation { private String pathParams; private String prefixForPatch; private SchemaVersion version; + private String basePath; - public PatchOperation(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, SchemaVersion v) { + public PatchOperation(String useOpId, String xmlRootElementName, String tag, String path, + String pathParams, SchemaVersion v, String basePath) { super(); this.useOpId = useOpId; this.xmlRootElementName = xmlRootElementName; @@ -43,6 +45,7 @@ public class PatchOperation { this.pathParams = pathParams; this.prefixForPatch = ""; this.version = v; + this.basePath = basePath; } public void setPrefixForPatchRef(String prefixForPatchRef) { this.prefixForPatch = prefixForPatchRef; @@ -85,7 +88,7 @@ public class PatchOperation { if ( path.endsWith("/relationship") ) { pathSb.append(" summary: see node definition for valid relationships\n"); } else { - relationshipExamplesSb.append("[See Examples](apidocs/relations/"+version.toString()+"/"+useOpId+".json)"); + relationshipExamplesSb.append("[See Examples](apidocs" + basePath + "/relations/"+version.toString()+"/"+useOpId+".json)"); pathSb.append(" summary: update an existing " + xmlRootElementName + "\n"); pathSb.append(" description: |\n"); pathSb.append(" Update an existing " + xmlRootElementName + "\n"); diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutOperation.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutOperation.java index 3e69565..5895306 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutOperation.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutOperation.java @@ -33,8 +33,10 @@ public class PutOperation { private String path; private String pathParams; private SchemaVersion version; + private String basePath; - public PutOperation(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, SchemaVersion v) { + public PutOperation(String useOpId, String xmlRootElementName, String tag, String path, + String pathParams, SchemaVersion v, String basePath) { super(); this.useOpId = useOpId; this.xmlRootElementName = xmlRootElementName; @@ -42,6 +44,7 @@ public class PutOperation { this.path = path; this.pathParams = pathParams; this.version = v; + this.basePath = basePath; } @Override @@ -80,7 +83,7 @@ public class PutOperation { pathSb.append(" summary: create or update an existing " + xmlRootElementName + "\n"); pathSb.append(" description: |\n Create or update an existing " + xmlRootElementName + ".\n #\n Note! This PUT method has a corresponding PATCH method that can be used to update just a few of the fields of an existing object, rather than a full object replacement. An example can be found in the [PATCH section] below\n"); } - relationshipExamplesSb.append("[Valid relationship examples shown here](apidocs/relations/"+version.toString()+"/"+useOpId.replace("RelationshipListRelationship", "")+".json)"); + relationshipExamplesSb.append("[Valid relationship examples shown here](apidocs" + basePath + "/relations/"+version.toString()+"/"+useOpId.replace("RelationshipListRelationship", "")+".json)"); pathSb.append(" operationId: createOrUpdate" + useOpId + "\n"); pathSb.append(" consumes:\n"); pathSb.append(" - application/json\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 40d5c0e..0ec95e9 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 @@ -85,7 +85,7 @@ public class YAMLfromOXM extends OxmFileProcessor { sb.append("description: |"); if (versionSupportsSwaggerDiff(v.toString())) { sb.append("\n\n [Differences versus the previous schema version](" - + "apidocs/aai_swagger_" + v.toString() + ".diff)"); + + "apidocs" + basePath + "/aai_swagger_" + v.toString() + ".diff)"); } sb.append( 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. "); @@ -466,11 +466,11 @@ public class YAMLfromOXM extends OxmFileProcessor { logger.debug("opId vs useOpId:" + opId + " vs " + useOpId + " PathParams=" + pathParams); // add PUT PutOperation put = new PutOperation(useOpId, xmlRootElementName, tag, path, - pathParams == null ? "" : pathParams.toString(), this.v); + pathParams == null ? "" : pathParams.toString(), this.v, this.basePath); pathSb.append(put.toString()); // add PATCH PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, - pathParams == null ? "" : pathParams.toString(), this.v); + pathParams == null ? "" : pathParams.toString(), this.v, this.basePath); 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 9ad16d6..2207a90 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 @@ -252,7 +252,7 @@ public class NodesYAMLfromOXMTest { 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(" [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"); 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 e36d520..4fc1c84 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 @@ -45,7 +45,7 @@ public class PatchOperationTest { @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.[See Examples](apidocs/relations/v16/NetworkGenericVnfsGenericVnf.json)\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/aai/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("}") ) @@ -75,7 +75,7 @@ public class PatchOperationTest { @Test public void testToString() { - PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams, v); + PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams, v, "/aai" ); String modResult = patch.toString(); assertThat(modResult, is(this.result)); } diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java index 1b073d9..0a60b7f 100644 --- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java +++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java @@ -45,7 +45,7 @@ public class PutOperationTest { @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__"," put:\n tags:\n - Network\n summary: create or update an existing generic-vnf\n description: |\n Create or update an existing generic-vnf.\n #\n Note! This PUT method has a corresponding PATCH method that can be used to update just a few of the fields of an existing object, rather than a full object replacement. An example can be found in the [PATCH section] below\n operationId: createOrUpdateNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n - application/xml\n produces:\n - application/json\n - application/xml\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 created or updated. [Valid relationship examples shown here](apidocs/relations/"+v.toString()+"/NetworkGenericVnfsGenericVnf.json)\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__"," put:\n tags:\n - Network\n summary: create or update an existing generic-vnf\n description: |\n Create or update an existing generic-vnf.\n #\n Note! This PUT method has a corresponding PATCH method that can be used to update just a few of the fields of an existing object, rather than a full object replacement. An example can be found in the [PATCH section] below\n operationId: createOrUpdateNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n - application/xml\n produces:\n - application/json\n - application/xml\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 created or updated. [Valid relationship examples shown here](apidocs/aai/relations/"+v.toString()+"/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("}") ) @@ -75,7 +75,7 @@ public class PutOperationTest { @Test public void testToString() { - PutOperation put = new PutOperation(useOpId, xmlRootElementName, tag, path, pathParams, v); + PutOperation put = new PutOperation(useOpId, xmlRootElementName, tag, path, pathParams, v, "/aai"); String modResult = put.toString(); assertThat(modResult, is(this.result)); } 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 2ccf051..ad4f055 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 @@ -313,7 +313,7 @@ public class YAMLfromOXMTest { 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(" [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"); @@ -401,7 +401,7 @@ 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 created or updated. [Valid relationship examples shown here](apidocs/relations/v11/BusinessCustomersCustomerServiceSubscriptionsServiceSubscription.json)\n"); + sb.append(" description: service-subscription object that needs to be created or updated. [Valid relationship examples shown here](apidocs/aai/relations/v11/BusinessCustomersCustomerServiceSubscriptionsServiceSubscription.json)\n"); sb.append(" required: true\n"); sb.append(" schema:\n"); sb.append(" $ref: \"#/definitions/service-subscription\"\n"); @@ -444,7 +444,7 @@ public class YAMLfromOXMTest { sb.append(" - name: body\n"); sb.append(" in: body\n"); sb.append(" description: service-subscription object that needs to be updated."); - sb.append("[See Examples](apidocs/relations/v11/BusinessCustomersCustomerServiceSubscriptionsServiceSubscription.json)\n"); + sb.append("[See Examples](apidocs/aai/relations/v11/BusinessCustomersCustomerServiceSubscriptionsServiceSubscription.json)\n"); sb.append(" required: true\n"); sb.append(" schema:\n"); sb.append(" $ref: \"#/definitions/zzzz-patch-service-subscription\"\n"); @@ -557,7 +557,7 @@ 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 created or updated. [Valid relationship examples shown here](apidocs/relations/v11/BusinessCustomersCustomer.json)\n"); + sb.append(" description: customer object that needs to be created or updated. [Valid relationship examples shown here](apidocs/aai/relations/v11/BusinessCustomersCustomer.json)\n"); sb.append(" required: true\n"); sb.append(" schema:\n"); sb.append(" $ref: \"#/definitions/customer\"\n"); @@ -594,7 +594,7 @@ public class YAMLfromOXMTest { sb.append(" - name: body\n"); sb.append(" in: body\n"); sb.append(" description: customer object that needs to be updated."); - sb.append("[See Examples](apidocs/relations/v11/BusinessCustomersCustomer.json)\n"); + sb.append("[See Examples](apidocs/aai/relations/v11/BusinessCustomersCustomer.json)\n"); sb.append(" required: true\n"); sb.append(" schema:\n"); sb.append(" $ref: \"#/definitions/zzzz-patch-customer\"\n"); |