Added special handling for 'string' types with format 'uri' (OpenAPITools#3160) (#3161)

- implemented Kotlin
- implemented Java

Fixes OpenAPITools#3160
This commit is contained in:
Rainer Hermanns 2019-06-28 03:48:41 +02:00 committed by William Cheng
parent 73966a0152
commit 3a1b29b90c
2 changed files with 9 additions and 0 deletions

View File

@ -784,6 +784,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return p.getDefault().toString();
}
return null;
} else if (ModelUtils.isURISchema(p)) {
if (p.getDefault() != null) {
return "URI.create(\"" + escapeText((String) p.getDefault()) + "\")";
}
return null;
} else if (ModelUtils.isStringSchema(p)) {
if (p.getDefault() != null) {
String _default = (String) p.getDefault();

View File

@ -834,6 +834,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
if (p.getDefault() != null) {
return p.getDefault().toString();
}
} else if (ModelUtils.isURISchema(p)) {
if (p.getDefault() != null) {
return "URI.create('" + p.getDefault() + "')";
}
} else if (ModelUtils.isStringSchema(p)) {
if (p.getDefault() != null) {
return "'" + p.getDefault() + "'";