forked from loafle/openapi-generator-original
update samples
This commit is contained in:
@@ -9,11 +9,11 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
variables.ts
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -9,11 +9,11 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
variables.ts
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -9,11 +9,11 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
variables.ts
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -9,11 +9,11 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
variables.ts
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -9,11 +9,11 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
variables.ts
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -9,11 +9,11 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
variables.ts
|
||||
|
||||
@@ -9,12 +9,12 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
ng-package.json
|
||||
package.json
|
||||
|
||||
@@ -5,10 +5,10 @@ api/petApi.ts
|
||||
api/storeApi.ts
|
||||
api/userApi.ts
|
||||
git_push.sh
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
|
||||
@@ -5,12 +5,12 @@ api/petApi.ts
|
||||
api/storeApi.ts
|
||||
api/userApi.ts
|
||||
git_push.sh
|
||||
model/apiResponse.ts
|
||||
model/category.ts
|
||||
model/order.ts
|
||||
model/pet.ts
|
||||
model/tag.ts
|
||||
model/user.ts
|
||||
model/./apiResponse.ts
|
||||
model/./category.ts
|
||||
model/./order.ts
|
||||
model/./pet.ts
|
||||
model/./tag.ts
|
||||
model/./user.ts
|
||||
model/models.ts
|
||||
package.json
|
||||
tsconfig.json
|
||||
|
||||
@@ -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)
|
||||
/**
|
||||
* 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 = """{
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
@@ -91,24 +91,24 @@ fun Route.PetApi() {
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
} ],
|
||||
"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) {
|
||||
}"""
|
||||
|
||||
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"
|
||||
val exampleContentString = """{
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
@@ -125,24 +125,24 @@ fun Route.PetApi() {
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
"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>()
|
||||
|
||||
}"""
|
||||
|
||||
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"
|
||||
val exampleContentString = """{
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
@@ -159,70 +159,70 @@ fun Route.PetApi() {
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
"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") {
|
||||
}"""
|
||||
|
||||
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"
|
||||
val exampleContentString = """{
|
||||
"code" : 0,
|
||||
"type" : "type",
|
||||
"message" : "message"
|
||||
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)
|
||||
}"""
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 = """{
|
||||
"petId" : 6,
|
||||
"quantity" : 1,
|
||||
@@ -66,19 +66,19 @@ fun Route.StoreApi() {
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
"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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}"""
|
||||
|
||||
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"
|
||||
val exampleContentString = """{
|
||||
"petId" : 6,
|
||||
"quantity" : 1,
|
||||
@@ -86,14 +86,14 @@ fun Route.StoreApi() {
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
"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)
|
||||
}
|
||||
|
||||
}"""
|
||||
|
||||
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)
|
||||
|
||||
}
|
||||
/**
|
||||
* 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"
|
||||
val exampleContentString = """{
|
||||
"firstName" : "firstName",
|
||||
"lastName" : "lastName",
|
||||
@@ -78,30 +78,30 @@ fun Route.UserApi() {
|
||||
"id" : 0,
|
||||
"email" : "email",
|
||||
"username" : "username"
|
||||
"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)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}"""
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
Api/ApiServer.php
|
||||
Api/PetApiInterface.php
|
||||
Api/StoreApiInterface.php
|
||||
Api/UserApiInterface.php
|
||||
Controller/Controller.php
|
||||
Controller/PetController.php
|
||||
Controller/StoreController.php
|
||||
Controller/UserController.php
|
||||
Model/ApiResponse.php
|
||||
Model/Category.php
|
||||
Model/Order.php
|
||||
Model/Pet.php
|
||||
Model/Tag.php
|
||||
Model/User.php
|
||||
Service/JmsSerializer.php
|
||||
Service/SerializerInterface.php
|
||||
Service/StrictJsonDeserializationVisitor.php
|
||||
Service/SymfonyValidator.php
|
||||
Service/TypeMismatchException.php
|
||||
Service/ValidatorInterface.php
|
||||
Tests/AppKernel.php
|
||||
Tests/Controller/ControllerTest.php
|
||||
Tests/test_config.yml
|
||||
./Api/ApiServer.php
|
||||
./Api/PetApiInterface.php
|
||||
./Api/StoreApiInterface.php
|
||||
./Api/UserApiInterface.php
|
||||
./Controller/Controller.php
|
||||
./Controller/PetController.php
|
||||
./Controller/StoreController.php
|
||||
./Controller/UserController.php
|
||||
./Model/ApiResponse.php
|
||||
./Model/Category.php
|
||||
./Model/Order.php
|
||||
./Model/Pet.php
|
||||
./Model/Tag.php
|
||||
./Model/User.php
|
||||
./Service/JmsSerializer.php
|
||||
./Service/SerializerInterface.php
|
||||
./Service/StrictJsonDeserializationVisitor.php
|
||||
./Service/SymfonyValidator.php
|
||||
./Service/TypeMismatchException.php
|
||||
./Service/ValidatorInterface.php
|
||||
./Tests/AppKernel.php
|
||||
./Tests/Controller/ControllerTest.php
|
||||
./Tests/test_config.yml
|
||||
.coveralls.yml
|
||||
.gitignore
|
||||
.php_cs.dist
|
||||
|
||||
Reference in New Issue
Block a user