[BUG] [KOTLIN] Fix default value generation for Kotlin Strings (#5776)

* fix default value generation for kotlin

* add updated pet templates

* Revert "add updated pet templates"

This reverts commit 7e8168ad

* regen pet store projects code
This commit is contained in:
Alex Buchkovsky
2020-04-05 20:30:03 +03:00
committed by GitHub
parent 3b495bab12
commit 166aae6fec
14 changed files with 94 additions and 75 deletions

View File

@@ -940,7 +940,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
} }
} else if (ModelUtils.isStringSchema(p)) { } else if (ModelUtils.isStringSchema(p)) {
if (p.getDefault() != null) { if (p.getDefault() != null) {
return "'" + p.getDefault() + "'"; return "\"" + p.getDefault() + "\"";
} }
} }

View File

@@ -1 +1 @@
4.2.3-SNAPSHOT 4.3.1-SNAPSHOT

View File

@@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
mavenCentral() maven { url = uri("https://repo1.maven.org/maven2") }
} }
dependencies { dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3")
@@ -15,7 +15,7 @@ version = "1.0.0"
repositories { repositories {
jcenter() jcenter()
mavenCentral() maven { url = uri("https://repo1.maven.org/maven2") }
} }
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
@@ -48,7 +48,7 @@ dependencies {
} }
repositories { repositories {
mavenCentral() maven { url = uri("https://repo1.maven.org/maven2") }
maven { url = uri("https://repo.spring.io/snapshot") } maven { url = uri("https://repo.spring.io/snapshot") }
maven { url = uri("https://repo.spring.io/milestone") } maven { url = uri("https://repo.spring.io/milestone") }
} }

View File

@@ -0,0 +1,19 @@
package org.openapitools.api
import org.springframework.web.context.request.NativeWebRequest
import javax.servlet.http.HttpServletResponse
import java.io.IOException
object ApiUtil {
fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) {
try {
val res = req.getNativeResponse(HttpServletResponse::class.java)
res.setCharacterEncoding("UTF-8")
res.addHeader("Content-Type", contentType)
res.getWriter().print(example)
} catch (e: IOException) {
throw RuntimeException(e)
}
}
}

View File

@@ -1 +1 @@
4.2.1-SNAPSHOT 4.3.1-SNAPSHOT

View File

@@ -20,10 +20,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.annotation.JsonInclude
/** /**
* A pet for sale in the pet store * A pet for sale in the pet store
* @param id
* @param category
* @param name * @param name
* @param photoUrls * @param photoUrls
* @param id
* @param category
* @param tags * @param tags
* @param status pet status in the store * @param status pet status in the store
*/ */