forked from loafle/openapi-generator-original
[Kotlin SpringBoot Server] alternative: fix optional parameter not correctly declared in service (#2539)
* fix kotlin optional parameters * ensure kotlin samples up to date
This commit is contained in:
parent
3a0d520c38
commit
88cdbbc41f
@ -24,6 +24,7 @@ declare -a scripts=(
|
|||||||
"./bin/kotlin-client-string.sh"
|
"./bin/kotlin-client-string.sh"
|
||||||
"./bin/kotlin-client-threetenbp.sh"
|
"./bin/kotlin-client-threetenbp.sh"
|
||||||
"./bin/kotlin-server-petstore.sh"
|
"./bin/kotlin-server-petstore.sh"
|
||||||
|
"./bin/kotlin-springboot-petstore-server.sh"
|
||||||
"./bin/mysql-schema-petstore.sh"
|
"./bin/mysql-schema-petstore.sh"
|
||||||
"./bin/python-petstore-all.sh"
|
"./bin/python-petstore-all.sh"
|
||||||
"./bin/openapi3/python-petstore.sh"
|
"./bin/openapi3/python-petstore.sh"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||||
|
|
||||||
If Not Exist %executable% (
|
If Not Exist %executable% (
|
||||||
mvn clean package
|
mvn clean package
|
||||||
)
|
)
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin-spring -o samples\server\petstore\kotlin-springboot --additional-properties=library=spring-boot
|
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin-spring -o samples\server\petstore\kotlin-springboot --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
java %JAVA_OPTS% -jar %executable% %ags%
|
||||||
|
@ -7,7 +7,7 @@ package {{package}}
|
|||||||
interface {{classname}}Service {
|
interface {{classname}}Service {
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
|
||||||
fun {{operationId}}({{#allParams}}{{paramName}}: {{{dataType}}}{{#hasMore}},{{/hasMore}}{{/allParams}}): {{>returnTypes}}
|
fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -8,7 +8,7 @@ import org.springframework.stereotype.Service
|
|||||||
class {{classname}}ServiceImpl : {{classname}}Service {
|
class {{classname}}ServiceImpl : {{classname}}Service {
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
|
||||||
override fun {{operationId}}({{#allParams}}{{paramName}}: {{{dataType}}}{{#hasMore}},{{/hasMore}}{{/allParams}}): {{>returnTypes}} {
|
override fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
@ -7,7 +7,7 @@ interface PetApiService {
|
|||||||
|
|
||||||
fun addPet(body: Pet): Unit
|
fun addPet(body: Pet): Unit
|
||||||
|
|
||||||
fun deletePet(petId: Long,apiKey: String): Unit
|
fun deletePet(petId: Long, apiKey: String?): Unit
|
||||||
|
|
||||||
fun findPetsByStatus(status: List<String>): List<Pet>
|
fun findPetsByStatus(status: List<String>): List<Pet>
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ interface PetApiService {
|
|||||||
|
|
||||||
fun updatePet(body: Pet): Unit
|
fun updatePet(body: Pet): Unit
|
||||||
|
|
||||||
fun updatePetWithForm(petId: Long,name: String,status: String): Unit
|
fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit
|
||||||
|
|
||||||
fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.core.io.Resource): ModelApiResponse
|
fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class PetApiServiceImpl : PetApiService {
|
|||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deletePet(petId: Long,apiKey: String): Unit {
|
override fun deletePet(petId: Long, apiKey: String?): Unit {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,11 +30,11 @@ class PetApiServiceImpl : PetApiService {
|
|||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updatePetWithForm(petId: Long,name: String,status: String): Unit {
|
override fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.core.io.Resource): ModelApiResponse {
|
override fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@ interface UserApiService {
|
|||||||
|
|
||||||
fun getUserByName(username: String): User
|
fun getUserByName(username: String): User
|
||||||
|
|
||||||
fun loginUser(username: String,password: String): String
|
fun loginUser(username: String, password: String): String
|
||||||
|
|
||||||
fun logoutUser(): Unit
|
fun logoutUser(): Unit
|
||||||
|
|
||||||
fun updateUser(username: String,body: User): Unit
|
fun updateUser(username: String, body: User): Unit
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class UserApiServiceImpl : UserApiService {
|
|||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loginUser(username: String,password: String): String {
|
override fun loginUser(username: String, password: String): String {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class UserApiServiceImpl : UserApiService {
|
|||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateUser(username: String,body: User): Unit {
|
override fun updateUser(username: String, body: User): Unit {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user