com.regnosys.rosetta.generator.jsonschema.JsonSchemaTranslator Maven / Gradle / Ivy
package com.regnosys.rosetta.generator.jsonschema;
import com.regnosys.rosetta.generator.object.ExpandedType;
import org.eclipse.xtext.xbase.lib.StringExtensions;
@SuppressWarnings("all")
public class JsonSchemaTranslator {
public static String toJsonSchemaBasicType(final String typename) {
String _switchResult = null;
if (typename != null) {
switch (typename) {
case "string":
case "time":
case "date":
case "dateTime":
case "zonedDateTime":
case "calculation":
_switchResult = "string";
break;
case "int":
_switchResult = "integer";
break;
case "number":
_switchResult = "number";
break;
case "boolean":
_switchResult = "boolean";
break;
}
}
return _switchResult;
}
public static String toJsonSchemaType(final ExpandedType type) {
final String basicType = JsonSchemaTranslator.toJsonSchemaBasicType(type.getName());
if ((basicType != null)) {
return basicType;
} else {
return StringExtensions.toFirstUpper(type.getName());
}
}
}