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/AutoGenerateHtml.java50
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java30
2 files changed, 55 insertions, 25 deletions
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java
index f279aef..13fd317 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java
@@ -22,6 +22,8 @@
package org.onap.aai.schemagen;
+import freemarker.template.TemplateException;
+
import java.io.File;
import java.io.IOException;
import java.util.Collections;
@@ -36,8 +38,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import freemarker.template.TemplateException;
-
public class AutoGenerateHtml {
private static Logger logger = LoggerFactory.getLogger(AutoGenerateHtml.class);
@@ -54,31 +54,31 @@ public class AutoGenerateHtml {
try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
"org.onap.aai.setup", "org.onap.aai.schemagen")) {
- SchemaConfigVersions schemaConfigVersions = ctx.getBean(SchemaConfigVersions.class);
+ SchemaConfigVersions schemaConfigVersions = ctx.getBean(SchemaConfigVersions.class);
- List<SchemaVersion> versionsToGen = schemaConfigVersions.getVersions();
- Collections.sort(versionsToGen);
- Collections.reverse(versionsToGen);
- ListIterator<SchemaVersion> versionIterator = versionsToGen.listIterator();
- String schemaDir;
- if (System.getProperty("user.dir") != null
- && !System.getProperty("user.dir").contains(DEFAULT_RUN_DIR)) {
- schemaDir = ALT_SCHEMA_DIR;
- } else {
- schemaDir = DEFAULT_SCHEMA_DIR;
- }
- String release = System.getProperty("aai.release", "onap");
- while (versionIterator.hasNext()) {
- System.setProperty(AAI_GENERATE_VERSION, versionIterator.next().toString());
- String yamlFile =
- schemaDir + "/src/main/resources/" + release + "/aai_swagger_yaml/aai_swagger_"
- + System.getProperty(AAI_GENERATE_VERSION) + ".yaml";
- File swaggerYamlFile = new File(yamlFile);
- if (swaggerYamlFile.exists()) {
- GenerateSwagger.schemaConfigVersions = schemaConfigVersions;
- GenerateSwagger.main(args);
+ List<SchemaVersion> versionsToGen = schemaConfigVersions.getVersions();
+ Collections.sort(versionsToGen);
+ Collections.reverse(versionsToGen);
+ ListIterator<SchemaVersion> versionIterator = versionsToGen.listIterator();
+ String schemaDir;
+ if (System.getProperty("user.dir") != null
+ && !System.getProperty("user.dir").contains(DEFAULT_RUN_DIR)) {
+ schemaDir = ALT_SCHEMA_DIR;
+ } else {
+ schemaDir = DEFAULT_SCHEMA_DIR;
+ }
+ String release = System.getProperty("aai.release", "onap");
+ while (versionIterator.hasNext()) {
+ System.setProperty(AAI_GENERATE_VERSION, versionIterator.next().toString());
+ String yamlFile =
+ schemaDir + "/src/main/resources/" + release + "/aai_swagger_yaml/aai_swagger_"
+ + System.getProperty(AAI_GENERATE_VERSION) + ".yaml";
+ File swaggerYamlFile = new File(yamlFile);
+ if (swaggerYamlFile.exists()) {
+ GenerateSwagger.schemaConfigVersions = schemaConfigVersions;
+ GenerateSwagger.main(args);
+ }
}
- }
} catch (BeansException e) {
logger.warn("Unable to initialize AnnotationConfigApplicationContext ", 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 205d16c..fa00b5e 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
@@ -283,6 +283,14 @@ public class XSDElement implements Element {
sbParameter.append(" type: integer\n");
sbParameter.append(" format: int32\n");
}
+ if (("java.lang.Float").equals(this.getAttribute("type"))) {
+ sbParameter.append(" type: number\n");
+ sbParameter.append(" format: float\n");
+ }
+ if (("java.lang.Double").equals(this.getAttribute("type"))) {
+ sbParameter.append(" type: number\n");
+ sbParameter.append(" format: double\n");
+ }
if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
sbParameter.append(" type: boolean\n");
}
@@ -316,6 +324,14 @@ public class XSDElement implements Element {
sbParameter.append(" type: integer\n");
sbParameter.append(" format: int32\n");
}
+ if (("java.lang.Float").equals(this.getAttribute("type"))) {
+ sbParameter.append(" type: number\n");
+ sbParameter.append(" format: float\n");
+ }
+ if (("java.lang.Double").equals(this.getAttribute("type"))) {
+ sbParameter.append(" type: number\n");
+ sbParameter.append(" format: double\n");
+ }
if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
sbParameter.append(" type: boolean\n");
}
@@ -351,6 +367,12 @@ public class XSDElement implements Element {
if (elementType.equals("java.lang.Integer")) {
sbElement.append(" type=\"xs:int\"");
}
+ if (elementType.equals("java.lang.Float")) {
+ sbElement.append(" type=\"xs:float\"");
+ }
+ if (elementType.equals("java.lang.Double")) {
+ sbElement.append(" type=\"xs:double\"");
+ }
if (elementType.equals("java.lang.Boolean")) {
sbElement.append(" type=\"xs:boolean\"");
}
@@ -473,6 +495,12 @@ public class XSDElement implements Element {
} else if (("java.lang.Integer").equals(this.getAttribute("type"))) {
sbProperties.append("integer\n");
sbProperties.append(" format: int32\n");
+ } else if (("java.lang.Float").equals(this.getAttribute("type"))) {
+ sbProperties.append("number\n");
+ sbProperties.append(" format: float\n");
+ } else if (("java.lang.Double").equals(this.getAttribute("type"))) {
+ sbProperties.append("number\n");
+ sbProperties.append(" format: double\n");
} else if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
sbProperties.append("boolean\n");
}
@@ -507,6 +535,8 @@ public class XSDElement implements Element {
case "java.lang.String":
case "java.lang.Long":
case "java.lang.Integer":
+ case "java.lang.Float":
+ case "java.lang.Double":
case "java.lang.Boolean":
return true;
}