forked from loafle/openapi-generator-original
add updated pet templates
This commit is contained in:
@@ -1,80 +1,80 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.server.apis
|
||||
|
||||
import com.google.gson.Gson
|
||||
import io.ktor.application.call
|
||||
import io.ktor.auth.UserIdPrincipal
|
||||
import io.ktor.auth.authentication
|
||||
import io.ktor.auth.authenticate
|
||||
import io.ktor.auth.OAuthAccessTokenResponse
|
||||
import io.ktor.auth.OAuthServerSettings
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.locations.delete
|
||||
import io.ktor.locations.get
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.routing.post
|
||||
import io.ktor.routing.put
|
||||
import io.ktor.routing.route
|
||||
|
||||
import org.openapitools.server.Paths
|
||||
import org.openapitools.server.infrastructure.ApiPrincipal
|
||||
|
||||
|
||||
import org.openapitools.server.models.ApiResponse
|
||||
import org.openapitools.server.models.Pet
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
fun Route.PetApi() {
|
||||
val gson = Gson()
|
||||
val empty = mutableMapOf<String, Any?>()
|
||||
|
||||
route("/pet") {
|
||||
authenticate("petstore_auth") {
|
||||
post {
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
delete<Paths.deletePet> { _: Paths.deletePet ->
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
get<Paths.findPetsByStatus> { _: Paths.findPetsByStatus ->
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
val exampleContentType = "application/json"
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.server.apis
|
||||
|
||||
import com.google.gson.Gson
|
||||
import io.ktor.application.call
|
||||
import io.ktor.auth.UserIdPrincipal
|
||||
import io.ktor.auth.authentication
|
||||
import io.ktor.auth.authenticate
|
||||
import io.ktor.auth.OAuthAccessTokenResponse
|
||||
import io.ktor.auth.OAuthServerSettings
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.locations.delete
|
||||
import io.ktor.locations.get
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.routing.post
|
||||
import io.ktor.routing.put
|
||||
import io.ktor.routing.route
|
||||
|
||||
import org.openapitools.server.Paths
|
||||
import org.openapitools.server.infrastructure.ApiPrincipal
|
||||
|
||||
|
||||
import org.openapitools.server.models.ApiResponse
|
||||
import org.openapitools.server.models.Pet
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
fun Route.PetApi() {
|
||||
val gson = Gson()
|
||||
val empty = mutableMapOf<String, Any?>()
|
||||
|
||||
route("/pet") {
|
||||
authenticate("petstore_auth") {
|
||||
post {
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
delete<Paths.deletePet> { _: Paths.deletePet ->
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
get<Paths.findPetsByStatus> { _: Paths.findPetsByStatus ->
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """{
|
||||
@@ -91,24 +91,24 @@ fun Route.PetApi() {
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
get<Paths.findPetsByTags> { _: Paths.findPetsByTags ->
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
val exampleContentType = "application/json"
|
||||
} ],
|
||||
"status" : "available"
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
get<Paths.findPetsByTags> { _: Paths.findPetsByTags ->
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
val exampleContentType = "application/json"
|
||||
@@ -125,24 +125,24 @@ fun Route.PetApi() {
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
get<Paths.getPetById> { _: Paths.getPetById ->
|
||||
val principal = call.authentication.principal<ApiPrincipal>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
val exampleContentType = "application/json"
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
get<Paths.getPetById> { _: Paths.getPetById ->
|
||||
val principal = call.authentication.principal<ApiPrincipal>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
@@ -159,70 +159,70 @@ fun Route.PetApi() {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/pet") {
|
||||
authenticate("petstore_auth") {
|
||||
put {
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/pet/{petId}") {
|
||||
authenticate("petstore_auth") {
|
||||
post {
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/pet/{petId}/uploadImage") {
|
||||
authenticate("petstore_auth") {
|
||||
post {
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
val exampleContentType = "application/json"
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
route("/pet") {
|
||||
authenticate("petstore_auth") {
|
||||
put {
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/pet/{petId}") {
|
||||
authenticate("petstore_auth") {
|
||||
post {
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/pet/{petId}/uploadImage") {
|
||||
authenticate("petstore_auth") {
|
||||
post {
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()
|
||||
|
||||
if (principal == null) {
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """{
|
||||
"code" : 0,
|
||||
"type" : "type",
|
||||
"message" : "message"
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.server.apis
|
||||
|
||||
import com.google.gson.Gson
|
||||
import io.ktor.application.call
|
||||
import io.ktor.auth.UserIdPrincipal
|
||||
import io.ktor.auth.authentication
|
||||
import io.ktor.auth.authenticate
|
||||
import io.ktor.auth.OAuthAccessTokenResponse
|
||||
import io.ktor.auth.OAuthServerSettings
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.locations.delete
|
||||
import io.ktor.locations.get
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.routing.post
|
||||
import io.ktor.routing.put
|
||||
import io.ktor.routing.route
|
||||
|
||||
import org.openapitools.server.Paths
|
||||
import org.openapitools.server.infrastructure.ApiPrincipal
|
||||
|
||||
|
||||
import org.openapitools.server.models.Order
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
fun Route.StoreApi() {
|
||||
val gson = Gson()
|
||||
val empty = mutableMapOf<String, Any?>()
|
||||
|
||||
delete<Paths.deleteOrder> { _: Paths.deleteOrder ->
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
|
||||
get<Paths.getInventory> { _: Paths.getInventory ->
|
||||
val principal = call.authentication.principal<ApiPrincipal>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
get<Paths.getOrderById> { _: Paths.getOrderById ->
|
||||
val exampleContentType = "application/json"
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.server.apis
|
||||
|
||||
import com.google.gson.Gson
|
||||
import io.ktor.application.call
|
||||
import io.ktor.auth.UserIdPrincipal
|
||||
import io.ktor.auth.authentication
|
||||
import io.ktor.auth.authenticate
|
||||
import io.ktor.auth.OAuthAccessTokenResponse
|
||||
import io.ktor.auth.OAuthServerSettings
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.locations.delete
|
||||
import io.ktor.locations.get
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.routing.post
|
||||
import io.ktor.routing.put
|
||||
import io.ktor.routing.route
|
||||
|
||||
import org.openapitools.server.Paths
|
||||
import org.openapitools.server.infrastructure.ApiPrincipal
|
||||
|
||||
|
||||
import org.openapitools.server.models.Order
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
fun Route.StoreApi() {
|
||||
val gson = Gson()
|
||||
val empty = mutableMapOf<String, Any?>()
|
||||
|
||||
delete<Paths.deleteOrder> { _: Paths.deleteOrder ->
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
|
||||
}
|
||||
|
||||
|
||||
get<Paths.getInventory> { _: Paths.getInventory ->
|
||||
val principal = call.authentication.principal<ApiPrincipal>()
|
||||
|
||||
if (principal == null) {
|
||||
call.respond(HttpStatusCode.Unauthorized)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
get<Paths.getOrderById> { _: Paths.getOrderById ->
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """{
|
||||
@@ -66,19 +66,19 @@ fun Route.StoreApi() {
|
||||
"quantity" : 1,
|
||||
"id" : 0,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/store/order") {
|
||||
post {
|
||||
val exampleContentType = "application/json"
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
route("/store/order") {
|
||||
post {
|
||||
val exampleContentType = "application/json"
|
||||
@@ -86,14 +86,14 @@ fun Route.StoreApi() {
|
||||
"petId" : 6,
|
||||
"quantity" : 1,
|
||||
"id" : 0,
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,74 +1,74 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.server.apis
|
||||
|
||||
import com.google.gson.Gson
|
||||
import io.ktor.application.call
|
||||
import io.ktor.auth.UserIdPrincipal
|
||||
import io.ktor.auth.authentication
|
||||
import io.ktor.auth.authenticate
|
||||
import io.ktor.auth.OAuthAccessTokenResponse
|
||||
import io.ktor.auth.OAuthServerSettings
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.locations.delete
|
||||
import io.ktor.locations.get
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.routing.post
|
||||
import io.ktor.routing.put
|
||||
import io.ktor.routing.route
|
||||
|
||||
import org.openapitools.server.Paths
|
||||
import org.openapitools.server.infrastructure.ApiPrincipal
|
||||
|
||||
|
||||
import org.openapitools.server.models.User
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
fun Route.UserApi() {
|
||||
val gson = Gson()
|
||||
val empty = mutableMapOf<String, Any?>()
|
||||
|
||||
route("/user") {
|
||||
post {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/user/createWithArray") {
|
||||
post {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/user/createWithList") {
|
||||
post {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
delete<Paths.deleteUser> { _: Paths.deleteUser ->
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
|
||||
get<Paths.getUserByName> { _: Paths.getUserByName ->
|
||||
val exampleContentType = "application/json"
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.server.apis
|
||||
|
||||
import com.google.gson.Gson
|
||||
import io.ktor.application.call
|
||||
import io.ktor.auth.UserIdPrincipal
|
||||
import io.ktor.auth.authentication
|
||||
import io.ktor.auth.authenticate
|
||||
import io.ktor.auth.OAuthAccessTokenResponse
|
||||
import io.ktor.auth.OAuthServerSettings
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.locations.delete
|
||||
import io.ktor.locations.get
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.routing.post
|
||||
import io.ktor.routing.put
|
||||
import io.ktor.routing.route
|
||||
|
||||
import org.openapitools.server.Paths
|
||||
import org.openapitools.server.infrastructure.ApiPrincipal
|
||||
|
||||
|
||||
import org.openapitools.server.models.User
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
fun Route.UserApi() {
|
||||
val gson = Gson()
|
||||
val empty = mutableMapOf<String, Any?>()
|
||||
|
||||
route("/user") {
|
||||
post {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/user/createWithArray") {
|
||||
post {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route("/user/createWithList") {
|
||||
post {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
delete<Paths.deleteUser> { _: Paths.deleteUser ->
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
|
||||
}
|
||||
|
||||
|
||||
get<Paths.getUserByName> { _: Paths.getUserByName ->
|
||||
@@ -78,30 +78,30 @@ fun Route.UserApi() {
|
||||
"lastName" : "lastName",
|
||||
"password" : "password",
|
||||
"userStatus" : 6,
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
get<Paths.loginUser> { _: Paths.loginUser ->
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
|
||||
get<Paths.logoutUser> { _: Paths.logoutUser ->
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
|
||||
|
||||
route("/user/{username}") {
|
||||
put {
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
"phone" : "phone",
|
||||
"id" : 0,
|
||||
"email" : "email",
|
||||
"username" : "username"
|
||||
}"""
|
||||
|
||||
when(exampleContentType) {
|
||||
"application/json" -> call.respond(gson.fromJson(exampleContentString, empty::class.java))
|
||||
"application/xml" -> call.respondText(exampleContentString, ContentType.Text.Xml)
|
||||
else -> call.respondText(exampleContentString)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
get<Paths.loginUser> { _: Paths.loginUser ->
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
|
||||
}
|
||||
|
||||
|
||||
get<Paths.logoutUser> { _: Paths.logoutUser ->
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.2.3-SNAPSHOT
|
||||
4.3.1-SNAPSHOT
|
||||
@@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo1.maven.org/maven2") }
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3")
|
||||
@@ -15,7 +15,7 @@ version = "1.0.0"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo1.maven.org/maven2") }
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
@@ -48,7 +48,7 @@ dependencies {
|
||||
}
|
||||
|
||||
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/milestone") }
|
||||
}
|
||||
|
||||
@@ -17,13 +17,13 @@ class DefaultExceptionHandler {
|
||||
|
||||
@ExceptionHandler(value = [ApiException::class])
|
||||
fun onApiException(ex: ApiException, response: HttpServletResponse): Unit =
|
||||
response.sendError(ex.code, ex.message)
|
||||
response.sendError(ex.code, ex.message)
|
||||
|
||||
@ExceptionHandler(value = [NotImplementedError::class])
|
||||
fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit =
|
||||
response.sendError(HttpStatus.NOT_IMPLEMENTED.value())
|
||||
response.sendError(HttpStatus.NOT_IMPLEMENTED.value())
|
||||
|
||||
@ExceptionHandler(value = [ConstraintViolationException::class])
|
||||
fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit =
|
||||
response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message })
|
||||
response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message })
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ import io.swagger.annotations.ApiModelProperty
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
data class Category (
|
||||
data class Category(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") var name: kotlin.String? = null
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") var name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -17,16 +17,16 @@ import io.swagger.annotations.ApiModelProperty
|
||||
* @param type
|
||||
* @param message
|
||||
*/
|
||||
data class ModelApiResponse (
|
||||
data class ModelApiResponse(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("code") var code: kotlin.Int? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("code") var code: kotlin.Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("type") var type: kotlin.String? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("type") var type: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("message") var message: kotlin.String? = null
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("message") var message: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -21,25 +21,25 @@ import io.swagger.annotations.ApiModelProperty
|
||||
* @param status Order Status
|
||||
* @param complete
|
||||
*/
|
||||
data class Order (
|
||||
data class Order(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("petId") var petId: kotlin.Long? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("petId") var petId: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("quantity") var quantity: kotlin.Int? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("quantity") var quantity: kotlin.Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("shipDate") var shipDate: java.time.OffsetDateTime? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("shipDate") var shipDate: java.time.OffsetDateTime? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Order Status")
|
||||
@JsonProperty("status") var status: Order.Status? = null,
|
||||
@ApiModelProperty(example = "null", value = "Order Status")
|
||||
@JsonProperty("status") var status: Order.Status? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("complete") var complete: kotlin.Boolean? = null
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("complete") var complete: kotlin.Boolean? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,27 +23,27 @@ import io.swagger.annotations.ApiModelProperty
|
||||
* @param tags
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
data class Pet (
|
||||
data class Pet(
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
@JsonProperty("name") var name: kotlin.String,
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
@JsonProperty("name") var name: kotlin.String,
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
@JsonProperty("photoUrls") var photoUrls: kotlin.collections.List<kotlin.String>,
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
@JsonProperty("photoUrls") var photoUrls: kotlin.collections.List<kotlin.String>,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("category") var category: Category? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("category") var category: Category? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("tags") var tags: kotlin.collections.List<Tag>? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("tags") var tags: kotlin.collections.List<Tag>? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
@JsonProperty("status") var status: Pet.Status? = null
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
@JsonProperty("status") var status: Pet.Status? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,13 +16,13 @@ import io.swagger.annotations.ApiModelProperty
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
data class Tag (
|
||||
data class Tag(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") var name: kotlin.String? = null
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") var name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -22,31 +22,31 @@ import io.swagger.annotations.ApiModelProperty
|
||||
* @param phone
|
||||
* @param userStatus User Status
|
||||
*/
|
||||
data class User (
|
||||
data class User(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") var id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("username") var username: kotlin.String? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("username") var username: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("firstName") var firstName: kotlin.String? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("firstName") var firstName: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("lastName") var lastName: kotlin.String? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("lastName") var lastName: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("email") var email: kotlin.String? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("email") var email: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("password") var password: kotlin.String? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("password") var password: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("phone") var phone: kotlin.String? = null,
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("phone") var phone: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
@JsonProperty("userStatus") var userStatus: kotlin.Int? = null
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
@JsonProperty("userStatus") var userStatus: kotlin.Int? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.2.1-SNAPSHOT
|
||||
4.3.1-SNAPSHOT
|
||||
@@ -7,7 +7,7 @@
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>OpenAPI Petstore</name>
|
||||
<name>OpenAPI Petstore</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -187,4 +187,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
@@ -20,10 +20,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
* @param id
|
||||
* @param category
|
||||
* @param name
|
||||
* @param photoUrls
|
||||
* @param id
|
||||
* @param category
|
||||
* @param tags
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user