From a8ce62a3bae5976982f6d1432723251a414e2878 Mon Sep 17 00:00:00 2001 From: "LaMont, William(wl2432)" Date: Fri, 12 Jun 2020 13:35:23 -0400 Subject: v20 support in schema-service without javafx Issue-ID: AAI-2930 Change-Id: I68ba45069f465988e21602521e8e665cb27318d1 Signed-off-by: LaMont, William(wl2432) --- .../src/main/java/org/onap/aai/schemagen/genxsd/HTMLfromOXM.java | 9 +-------- .../java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java | 2 +- .../main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java | 7 +++++-- .../main/java/org/onap/aai/schemagen/genxsd/PutOperation.java | 7 +++++-- .../src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java | 6 +++--- 5 files changed, 15 insertions(+), 16 deletions(-) (limited to 'aai-schema-gen/src/main/java/org/onap') 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 -- cgit 1.2.3-korg