forked from loafle/openapi-generator-original
Support library option via additionalProperties (#16242)
* set library option obtain from additionalProperties * test library * update samples * remove old files
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
generatorName: java
|
generatorName: java
|
||||||
outputDir: samples/client/petstore/java/resteasy
|
outputDir: samples/client/petstore/java/resteasy
|
||||||
library: resteasy
|
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
artifactId: petstore-resteasy
|
artifactId: petstore-resteasy
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
|
library: resteasy
|
||||||
|
|||||||
@@ -746,6 +746,11 @@ public class CodegenConfigurator {
|
|||||||
config.additionalProperties().put(CodegenConstants.TEMPLATE_DIR, workflowSettings.getTemplateDir());
|
config.additionalProperties().put(CodegenConstants.TEMPLATE_DIR, workflowSettings.getTemplateDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if library is found in additionalProperties, set the library option accordingly
|
||||||
|
if (config.additionalProperties().containsKey("library")) {
|
||||||
|
config.setLibrary(String.valueOf(config.additionalProperties().get("library")));
|
||||||
|
}
|
||||||
|
|
||||||
ClientOptInput input = new ClientOptInput()
|
ClientOptInput input = new ClientOptInput()
|
||||||
.config(config)
|
.config(config)
|
||||||
.userDefinedTemplates(userDefinedTemplates);
|
.userDefinedTemplates(userDefinedTemplates);
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ gradlew
|
|||||||
gradlew.bat
|
gradlew.bat
|
||||||
settings.gradle
|
settings.gradle
|
||||||
src/main/AndroidManifest.xml
|
src/main/AndroidManifest.xml
|
||||||
src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
src/main/java/org/openapitools/client/apis/DefaultApi.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
src/main/java/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt
|
src/main/java/org/openapitools/client/infrastructure/CollectionFormats.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt
|
src/main/java/org/openapitools/client/infrastructure/CollectionFormats.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/java/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
|
src/main/java/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
|
src/main/java/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/request/GsonRequest.kt
|
src/main/java/org/openapitools/client/request/GsonRequest.kt
|
||||||
src/main/kotlin/org/openapitools/client/request/IRequestFactory.kt
|
src/main/java/org/openapitools/client/request/IRequestFactory.kt
|
||||||
src/main/kotlin/org/openapitools/client/request/RequestFactory.kt
|
src/main/java/org/openapitools/client/request/RequestFactory.kt
|
||||||
|
|||||||
@@ -6,22 +6,22 @@ gradle/wrapper/gradle-wrapper.properties
|
|||||||
gradlew
|
gradlew
|
||||||
gradlew.bat
|
gradlew.bat
|
||||||
settings.gradle.kts
|
settings.gradle.kts
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/Authentication.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/OAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
|
||||||
src/commonTest/kotlin/util/Coroutine.kt
|
src/commonTest/kotlin/util/Coroutine.kt
|
||||||
src/iosTest/kotlin/util/Coroutine.kt
|
src/iosTest/kotlin/util/Coroutine.kt
|
||||||
src/jsTest/kotlin/util/Coroutine.kt
|
src/jsTest/kotlin/util/Coroutine.kt
|
||||||
src/jvmTest/kotlin/util/Coroutine.kt
|
src/jvmTest/kotlin/util/Coroutine.kt
|
||||||
src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/Authentication.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/OAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Bytes.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
|
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.*
|
||||||
|
import io.ktor.client.HttpClientConfig
|
||||||
|
import io.ktor.client.request.forms.formData
|
||||||
|
import io.ktor.client.engine.HttpClientEngine
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import io.ktor.http.ParametersBuilder
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.descriptors.*
|
||||||
|
import kotlinx.serialization.encoding.*
|
||||||
|
|
||||||
|
open class DefaultApi(
|
||||||
|
baseUrl: String = ApiClient.BASE_URL,
|
||||||
|
httpClientEngine: HttpClientEngine? = null,
|
||||||
|
httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
|
||||||
|
jsonSerializer: Json = ApiClient.JSON_DEFAULT
|
||||||
|
) : ApiClient(baseUrl, httpClientEngine, httpClientConfig, jsonSerializer) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
open suspend fun idsGet(ids: kotlin.collections.List<kotlin.String>): HttpResponse<Unit> {
|
||||||
|
|
||||||
|
val localVariableAuthNames = listOf<String>()
|
||||||
|
|
||||||
|
val localVariableBody =
|
||||||
|
io.ktor.client.utils.EmptyContent
|
||||||
|
|
||||||
|
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||||
|
val localVariableHeaders = mutableMapOf<String, String>()
|
||||||
|
|
||||||
|
val localVariableConfig = RequestConfig<kotlin.Any?>(
|
||||||
|
RequestMethod.GET,
|
||||||
|
"/{ids}".replace("{" + "ids" + "}", ids.joinToString(",")),
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
)
|
||||||
|
|
||||||
|
return request(
|
||||||
|
localVariableConfig,
|
||||||
|
localVariableBody,
|
||||||
|
localVariableAuthNames
|
||||||
|
).wrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,23 +7,23 @@ gradle/wrapper/gradle-wrapper.properties
|
|||||||
gradlew
|
gradlew
|
||||||
gradlew.bat
|
gradlew.bat
|
||||||
settings.gradle.kts
|
settings.gradle.kts
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/Authentication.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/OAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/models/Apa.kt
|
||||||
src/commonTest/kotlin/util/Coroutine.kt
|
src/commonTest/kotlin/util/Coroutine.kt
|
||||||
src/iosTest/kotlin/util/Coroutine.kt
|
src/iosTest/kotlin/util/Coroutine.kt
|
||||||
src/jsTest/kotlin/util/Coroutine.kt
|
src/jsTest/kotlin/util/Coroutine.kt
|
||||||
src/jvmTest/kotlin/util/Coroutine.kt
|
src/jvmTest/kotlin/util/Coroutine.kt
|
||||||
src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/Authentication.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/OAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Bytes.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/models/Apa.kt
|
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import org.openapitools.client.models.Apa
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.*
|
||||||
|
import io.ktor.client.HttpClientConfig
|
||||||
|
import io.ktor.client.request.forms.formData
|
||||||
|
import io.ktor.client.engine.HttpClientEngine
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import io.ktor.http.ParametersBuilder
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.descriptors.*
|
||||||
|
import kotlinx.serialization.encoding.*
|
||||||
|
|
||||||
|
open class DefaultApi(
|
||||||
|
baseUrl: String = ApiClient.BASE_URL,
|
||||||
|
httpClientEngine: HttpClientEngine? = null,
|
||||||
|
httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
|
||||||
|
jsonSerializer: Json = ApiClient.JSON_DEFAULT
|
||||||
|
) : ApiClient(baseUrl, httpClientEngine, httpClientConfig, jsonSerializer) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param apa
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
open suspend fun testPost(apa: Apa): HttpResponse<Unit> {
|
||||||
|
|
||||||
|
val localVariableAuthNames = listOf<String>()
|
||||||
|
|
||||||
|
val localVariableBody = apa
|
||||||
|
|
||||||
|
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||||
|
val localVariableHeaders = mutableMapOf<String, String>()
|
||||||
|
|
||||||
|
val localVariableConfig = RequestConfig<kotlin.Any?>(
|
||||||
|
RequestMethod.POST,
|
||||||
|
"/test",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
)
|
||||||
|
|
||||||
|
return jsonRequest(
|
||||||
|
localVariableConfig,
|
||||||
|
localVariableBody,
|
||||||
|
localVariableAuthNames
|
||||||
|
).wrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
class ApiKeyAuth(private val location: String, val paramName: String) : Authentication {
|
||||||
|
var apiKey: String? = null
|
||||||
|
var apiKeyPrefix: String? = null
|
||||||
|
|
||||||
|
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
|
||||||
|
val key: String = apiKey ?: return
|
||||||
|
val prefix: String? = apiKeyPrefix
|
||||||
|
val value: String = if (prefix != null) "$prefix $key" else key
|
||||||
|
when (location) {
|
||||||
|
"query" -> query[paramName] = listOf(value)
|
||||||
|
"header" -> headers[paramName] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
interface Authentication {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply authentication settings to header and query params.
|
||||||
|
*
|
||||||
|
* @param query Query parameters.
|
||||||
|
* @param headers Header parameters.
|
||||||
|
*/
|
||||||
|
fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
import io.ktor.util.InternalAPI
|
||||||
|
import io.ktor.util.encodeBase64
|
||||||
|
|
||||||
|
class HttpBasicAuth : Authentication {
|
||||||
|
var username: String? = null
|
||||||
|
var password: String? = null
|
||||||
|
|
||||||
|
@OptIn(InternalAPI::class)
|
||||||
|
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
|
||||||
|
if (username == null && password == null) return
|
||||||
|
val str = (username ?: "") + ":" + (password ?: "")
|
||||||
|
val auth = str.encodeBase64()
|
||||||
|
headers["Authorization"] = "Basic $auth"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
class HttpBearerAuth(private val scheme: String?) : Authentication {
|
||||||
|
var bearerToken: String? = null
|
||||||
|
|
||||||
|
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
|
||||||
|
val token: String = bearerToken ?: return
|
||||||
|
headers["Authorization"] = (if (scheme != null) upperCaseBearer(scheme)!! + " " else "") + token
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun upperCaseBearer(scheme: String): String? {
|
||||||
|
return if ("bearer".equals(scheme, ignoreCase = true)) "Bearer" else scheme
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
class OAuth : Authentication {
|
||||||
|
var accessToken: String? = null
|
||||||
|
|
||||||
|
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
|
||||||
|
val token: String = accessToken ?: return
|
||||||
|
headers["Authorization"] = "Bearer $token"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
typealias MultiValueMap = MutableMap<String,List<String>>
|
||||||
|
|
||||||
|
fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
|
||||||
|
"csv" -> ","
|
||||||
|
"tsv" -> "\t"
|
||||||
|
"pipe" -> "|"
|
||||||
|
"space" -> " "
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
|
||||||
|
val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
|
||||||
|
|
||||||
|
fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
|
||||||
|
= toMultiValue(items.asIterable(), collectionFormat, map)
|
||||||
|
|
||||||
|
fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
|
||||||
|
return when(collectionFormat) {
|
||||||
|
"multi" -> items.map(map)
|
||||||
|
else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import io.ktor.client.HttpClient
|
||||||
|
import io.ktor.client.HttpClientConfig
|
||||||
|
import io.ktor.client.engine.HttpClientEngine
|
||||||
|
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
||||||
|
import io.ktor.client.request.*
|
||||||
|
import io.ktor.client.request.forms.FormDataContent
|
||||||
|
import io.ktor.client.request.forms.MultiPartFormDataContent
|
||||||
|
import io.ktor.client.request.header
|
||||||
|
import io.ktor.client.request.parameter
|
||||||
|
import io.ktor.client.statement.HttpResponse
|
||||||
|
import io.ktor.serialization.kotlinx.json.json
|
||||||
|
import io.ktor.http.*
|
||||||
|
import io.ktor.http.content.PartData
|
||||||
|
import kotlin.Unit
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
import org.openapitools.client.auth.*
|
||||||
|
|
||||||
|
open class ApiClient(
|
||||||
|
private val baseUrl: String,
|
||||||
|
httpClientEngine: HttpClientEngine?,
|
||||||
|
httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
|
||||||
|
private val jsonBlock: Json
|
||||||
|
) {
|
||||||
|
|
||||||
|
private val clientConfig: (HttpClientConfig<*>) -> Unit by lazy {
|
||||||
|
{
|
||||||
|
it.install(ContentNegotiation) { json(jsonBlock) }
|
||||||
|
httpClientConfig?.invoke(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val client: HttpClient by lazy {
|
||||||
|
httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val authentications: kotlin.collections.Map<String, Authentication>? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val BASE_URL = "http://localhost"
|
||||||
|
val JSON_DEFAULT = Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
prettyPrint = true
|
||||||
|
isLenient = true
|
||||||
|
}
|
||||||
|
protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the username for the first HTTP basic authentication.
|
||||||
|
*
|
||||||
|
* @param username Username
|
||||||
|
*/
|
||||||
|
fun setUsername(username: String) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth?
|
||||||
|
?: throw Exception("No HTTP basic authentication configured")
|
||||||
|
auth.username = username
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the password for the first HTTP basic authentication.
|
||||||
|
*
|
||||||
|
* @param password Password
|
||||||
|
*/
|
||||||
|
fun setPassword(password: String) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth?
|
||||||
|
?: throw Exception("No HTTP basic authentication configured")
|
||||||
|
auth.password = password
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API key value for the first API key authentication.
|
||||||
|
*
|
||||||
|
* @param apiKey API key
|
||||||
|
* @param paramName The name of the API key parameter, or null or set the first key.
|
||||||
|
*/
|
||||||
|
fun setApiKey(apiKey: String, paramName: String? = null) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth?
|
||||||
|
?: throw Exception("No API key authentication configured")
|
||||||
|
auth.apiKey = apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API key prefix for the first API key authentication.
|
||||||
|
*
|
||||||
|
* @param apiKeyPrefix API key prefix
|
||||||
|
* @param paramName The name of the API key parameter, or null or set the first key.
|
||||||
|
*/
|
||||||
|
fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth?
|
||||||
|
?: throw Exception("No API key authentication configured")
|
||||||
|
auth.apiKeyPrefix = apiKeyPrefix
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the access token for the first OAuth2 authentication.
|
||||||
|
*
|
||||||
|
* @param accessToken Access token
|
||||||
|
*/
|
||||||
|
fun setAccessToken(accessToken: String) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is OAuth } as OAuth?
|
||||||
|
?: throw Exception("No OAuth2 authentication configured")
|
||||||
|
auth.accessToken = accessToken
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the access token for the first Bearer authentication.
|
||||||
|
*
|
||||||
|
* @param bearerToken The bearer token.
|
||||||
|
*/
|
||||||
|
fun setBearerToken(bearerToken: String) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth?
|
||||||
|
?: throw Exception("No Bearer authentication configured")
|
||||||
|
auth.bearerToken = bearerToken
|
||||||
|
}
|
||||||
|
|
||||||
|
protected suspend fun <T: Any?> multipartFormRequest(requestConfig: RequestConfig<T>, body: kotlin.collections.List<PartData>?, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||||
|
return request(requestConfig, MultiPartFormDataContent(body ?: listOf()), authNames)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected suspend fun <T: Any?> urlEncodedFormRequest(requestConfig: RequestConfig<T>, body: Parameters?, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||||
|
return request(requestConfig, FormDataContent(body ?: Parameters.Empty), authNames)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected suspend fun <T: Any?> jsonRequest(requestConfig: RequestConfig<T>, body: Any? = null, authNames: kotlin.collections.List<String>): HttpResponse = request(requestConfig, body, authNames)
|
||||||
|
|
||||||
|
protected suspend fun <T: Any?> request(requestConfig: RequestConfig<T>, body: Any? = null, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||||
|
requestConfig.updateForAuth<T>(authNames)
|
||||||
|
val headers = requestConfig.headers
|
||||||
|
|
||||||
|
return client.request {
|
||||||
|
this.url {
|
||||||
|
this.takeFrom(URLBuilder(baseUrl))
|
||||||
|
appendPath(requestConfig.path.trimStart('/').split('/'))
|
||||||
|
requestConfig.query.forEach { query ->
|
||||||
|
query.value.forEach { value ->
|
||||||
|
parameter(query.key, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.method = requestConfig.method.httpMethod
|
||||||
|
headers.filter { header -> !UNSAFE_HEADERS.contains(header.key) }.forEach { header -> this.header(header.key, header.value) }
|
||||||
|
if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH)) {
|
||||||
|
this.setBody(body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun <T: Any?> RequestConfig<T>.updateForAuth(authNames: kotlin.collections.List<String>) {
|
||||||
|
for (authName in authNames) {
|
||||||
|
val auth = authentications?.get(authName) ?: throw Exception("Authentication undefined: $authName")
|
||||||
|
auth.apply(query, headers)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun URLBuilder.appendPath(components: kotlin.collections.List<String>): URLBuilder = apply {
|
||||||
|
encodedPath = encodedPath.trimEnd('/') + components.joinToString("/", prefix = "/") { it.encodeURLQueryComponent() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private val RequestMethod.httpMethod: HttpMethod
|
||||||
|
get() = when (this) {
|
||||||
|
RequestMethod.DELETE -> HttpMethod.Delete
|
||||||
|
RequestMethod.GET -> HttpMethod.Get
|
||||||
|
RequestMethod.HEAD -> HttpMethod.Head
|
||||||
|
RequestMethod.PATCH -> HttpMethod.Patch
|
||||||
|
RequestMethod.PUT -> HttpMethod.Put
|
||||||
|
RequestMethod.POST -> HttpMethod.Post
|
||||||
|
RequestMethod.OPTIONS -> HttpMethod.Options
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.descriptors.*
|
||||||
|
import kotlinx.serialization.encoding.*
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Base64ByteArray(val value: ByteArray) {
|
||||||
|
@Serializer(Base64ByteArray::class)
|
||||||
|
companion object : KSerializer<Base64ByteArray> {
|
||||||
|
override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING)
|
||||||
|
override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64())
|
||||||
|
override fun deserialize(decoder: Decoder) = Base64ByteArray(decoder.decodeString().decodeBase64Bytes())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other == null || this::class != other::class) return false
|
||||||
|
other as Base64ByteArray
|
||||||
|
return value.contentEquals(other.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return value.contentHashCode()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Base64ByteArray(${hex(value)})"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import io.ktor.utils.io.core.*
|
||||||
|
import kotlin.experimental.and
|
||||||
|
|
||||||
|
private val digits = "0123456789abcdef".toCharArray()
|
||||||
|
private const val BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||||
|
private const val BASE64_MASK: Byte = 0x3f
|
||||||
|
private const val BASE64_PAD = '='
|
||||||
|
private val BASE64_INVERSE_ALPHABET = IntArray(256) { BASE64_ALPHABET.indexOf(it.toChar()) }
|
||||||
|
|
||||||
|
private fun String.toCharArray(): CharArray = CharArray(length) { get(it) }
|
||||||
|
private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it] = 0 }
|
||||||
|
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
|
||||||
|
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
|
||||||
|
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
|
||||||
|
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { dropLastWhile { it == BASE64_PAD } }.decodeBase64Bytes().readBytes()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/ktorio/ktor/blob/master/ktor-utils/common/src/io/ktor/util/Crypto.kt
|
||||||
|
*/
|
||||||
|
internal fun hex(bytes: ByteArray): String {
|
||||||
|
val result = CharArray(bytes.size * 2)
|
||||||
|
var resultIndex = 0
|
||||||
|
val digits = digits
|
||||||
|
|
||||||
|
for (element in bytes) {
|
||||||
|
val b = element.toInt() and 0xff
|
||||||
|
result[resultIndex++] = digits[b shr 4]
|
||||||
|
result[resultIndex++] = digits[b and 0x0f]
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.concatToString()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode bytes from HEX string. It should be no spaces and `0x` prefixes.
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/ktorio/ktor/blob/master/ktor-utils/common/src/io/ktor/util/Crypto.kt
|
||||||
|
*/
|
||||||
|
internal fun hex(s: String): ByteArray {
|
||||||
|
val result = ByteArray(s.length / 2)
|
||||||
|
for (idx in result.indices) {
|
||||||
|
val srcIdx = idx * 2
|
||||||
|
val high = s[srcIdx].toString().toInt(16) shl 4
|
||||||
|
val low = s[srcIdx + 1].toString().toInt(16)
|
||||||
|
result[idx] = (high or low).toByte()
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode [ByteReadPacket] in base64 format.
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
|
||||||
|
*/
|
||||||
|
private fun ByteReadPacket.encodeBase64(): String = buildString {
|
||||||
|
val data = ByteArray(3)
|
||||||
|
while (remaining > 0) {
|
||||||
|
val read = readAvailable(data)
|
||||||
|
data.clearFrom(read)
|
||||||
|
|
||||||
|
val padSize = (data.size - read) * 8 / 6
|
||||||
|
val chunk = ((data[0].toInt() and 0xFF) shl 16) or
|
||||||
|
((data[1].toInt() and 0xFF) shl 8) or
|
||||||
|
(data[2].toInt() and 0xFF)
|
||||||
|
|
||||||
|
for (index in data.size downTo padSize) {
|
||||||
|
val char = (chunk shr (6 * index)) and BASE64_MASK.toInt()
|
||||||
|
append(char.toBase64())
|
||||||
|
}
|
||||||
|
|
||||||
|
repeat(padSize) { append(BASE64_PAD) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode [ByteReadPacket] from base64 format
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
|
||||||
|
*/
|
||||||
|
private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket {
|
||||||
|
val data = ByteArray(4)
|
||||||
|
|
||||||
|
while (remaining > 0) {
|
||||||
|
val read = readAvailable(data)
|
||||||
|
|
||||||
|
val chunk = data.foldIndexed(0) { index, result, current ->
|
||||||
|
result or (current.fromBase64().toInt() shl ((3 - index) * 6))
|
||||||
|
}
|
||||||
|
|
||||||
|
for (index in data.size - 2 downTo (data.size - read)) {
|
||||||
|
val origin = (chunk shr (8 * index)) and 0xff
|
||||||
|
writeByte(origin.toByte())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import io.ktor.http.Headers
|
||||||
|
import io.ktor.http.isSuccess
|
||||||
|
import io.ktor.util.reflect.TypeInfo
|
||||||
|
import io.ktor.util.reflect.typeInfo
|
||||||
|
|
||||||
|
open class HttpResponse<T : Any>(val response: io.ktor.client.statement.HttpResponse, val provider: BodyProvider<T>) {
|
||||||
|
val status: Int = response.status.value
|
||||||
|
val success: Boolean = response.status.isSuccess()
|
||||||
|
val headers: Map<String, List<String>> = response.headers.mapEntries()
|
||||||
|
suspend fun body(): T = provider.body(response)
|
||||||
|
suspend fun <V : Any> typedBody(type: TypeInfo): V = provider.typedBody(response, type)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private fun Headers.mapEntries(): Map<String, List<String>> {
|
||||||
|
val result = mutableMapOf<String, List<String>>()
|
||||||
|
entries().forEach { result[it.key] = it.value }
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BodyProvider<T : Any> {
|
||||||
|
suspend fun body(response: io.ktor.client.statement.HttpResponse): T
|
||||||
|
suspend fun <V : Any> typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V
|
||||||
|
}
|
||||||
|
|
||||||
|
class TypedBodyProvider<T : Any>(private val type: TypeInfo) : BodyProvider<T> {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
override suspend fun body(response: io.ktor.client.statement.HttpResponse): T =
|
||||||
|
response.call.body(type) as T
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
override suspend fun <V : Any> typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V =
|
||||||
|
response.call.body(type) as V
|
||||||
|
}
|
||||||
|
|
||||||
|
class MappedBodyProvider<S : Any, T : Any>(private val provider: BodyProvider<S>, private val block: S.() -> T) : BodyProvider<T> {
|
||||||
|
override suspend fun body(response: io.ktor.client.statement.HttpResponse): T =
|
||||||
|
block(provider.body(response))
|
||||||
|
|
||||||
|
override suspend fun <V : Any> typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V =
|
||||||
|
provider.typedBody(response, type)
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T : Any> io.ktor.client.statement.HttpResponse.wrap(): HttpResponse<T> =
|
||||||
|
HttpResponse(this, TypedBodyProvider(typeInfo<T>()))
|
||||||
|
|
||||||
|
fun <T : Any, V : Any> HttpResponse<T>.map(block: T.() -> V): HttpResponse<V> =
|
||||||
|
HttpResponse(response, MappedBodyProvider(provider, block))
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.descriptors.*
|
||||||
|
import kotlinx.serialization.encoding.*
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class OctetByteArray(val value: ByteArray) {
|
||||||
|
@Serializer(OctetByteArray::class)
|
||||||
|
companion object : KSerializer<OctetByteArray> {
|
||||||
|
override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING)
|
||||||
|
override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value))
|
||||||
|
override fun deserialize(decoder: Decoder) = OctetByteArray(hex(decoder.decodeString()))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other == null || this::class != other::class) return false
|
||||||
|
other as OctetByteArray
|
||||||
|
return value.contentEquals(other.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return value.contentHashCode()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "OctetByteArray(${hex(value)})"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a config object for a given part of a multi-part request.
|
||||||
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
|
* multi-valued headers as csv-only.
|
||||||
|
*/
|
||||||
|
data class PartConfig<T>(
|
||||||
|
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||||
|
val body: T? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a config object for a given request.
|
||||||
|
* NOTE: This object doesn't include 'body' because it
|
||||||
|
* allows for caching of the constructed object
|
||||||
|
* for many request definitions.
|
||||||
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
|
* multi-valued headers as csv-only.
|
||||||
|
*/
|
||||||
|
data class RequestConfig<T>(
|
||||||
|
val method: RequestMethod,
|
||||||
|
val path: String,
|
||||||
|
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||||
|
val query: MutableMap<String, List<String>> = mutableMapOf(),
|
||||||
|
val requiresAuthentication: Boolean,
|
||||||
|
val body: T? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides enumerated HTTP verbs
|
||||||
|
*/
|
||||||
|
enum class RequestMethod {
|
||||||
|
GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.descriptors.*
|
||||||
|
import kotlinx.serialization.encoding.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param bepa
|
||||||
|
* @param cepa
|
||||||
|
* @param depa
|
||||||
|
* @param epa
|
||||||
|
* @param fepa
|
||||||
|
* @param gepa
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
|
||||||
|
data class Apa (
|
||||||
|
|
||||||
|
@SerialName(value = "bepa") @Required val bepa: kotlin.Double = (0).toDouble(),
|
||||||
|
|
||||||
|
@SerialName(value = "cepa") @Required val cepa: kotlin.Double = (6.28318).toDouble(),
|
||||||
|
|
||||||
|
@SerialName(value = "depa") val depa: kotlin.Double? = (71).toDouble(),
|
||||||
|
|
||||||
|
@SerialName(value = "epa") val epa: kotlin.Double? = (-71).toDouble(),
|
||||||
|
|
||||||
|
@Deprecated(message = "This property is deprecated.")
|
||||||
|
@SerialName(value = "fepa") val fepa: kotlin.Double? = (100).toDouble(),
|
||||||
|
|
||||||
|
@SerialName(value = "gepa") val gepa: kotlin.Double? = null
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
@@ -9,16 +9,16 @@ gradlew
|
|||||||
gradlew.bat
|
gradlew.bat
|
||||||
settings.gradle
|
settings.gradle
|
||||||
src/main/AndroidManifest.xml
|
src/main/AndroidManifest.xml
|
||||||
src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
src/main/java/org/openapitools/client/apis/DefaultApi.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
src/main/java/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt
|
src/main/java/org/openapitools/client/infrastructure/CollectionFormats.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt
|
src/main/java/org/openapitools/client/infrastructure/CollectionFormats.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ITransformForStorage.kt
|
src/main/java/org/openapitools/client/infrastructure/ITransformForStorage.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
src/main/java/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
|
src/main/java/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
|
src/main/java/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
|
||||||
src/main/kotlin/org/openapitools/client/models/Apa.kt
|
src/main/java/org/openapitools/client/models/Apa.kt
|
||||||
src/main/kotlin/org/openapitools/client/models/room/ApaRoomModel.kt
|
src/main/java/org/openapitools/client/models/room/ApaRoomModel.kt
|
||||||
src/main/kotlin/org/openapitools/client/request/GsonRequest.kt
|
src/main/java/org/openapitools/client/request/GsonRequest.kt
|
||||||
src/main/kotlin/org/openapitools/client/request/IRequestFactory.kt
|
src/main/java/org/openapitools/client/request/IRequestFactory.kt
|
||||||
src/main/kotlin/org/openapitools/client/request/RequestFactory.kt
|
src/main/java/org/openapitools/client/request/RequestFactory.kt
|
||||||
|
|||||||
@@ -7,23 +7,23 @@ gradle/wrapper/gradle-wrapper.properties
|
|||||||
gradlew
|
gradlew
|
||||||
gradlew.bat
|
gradlew.bat
|
||||||
settings.gradle.kts
|
settings.gradle.kts
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/Authentication.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/auth/OAuth.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
|
||||||
|
src/commonMain/kotlin/org/openapitools/client/models/Apa.kt
|
||||||
src/commonTest/kotlin/util/Coroutine.kt
|
src/commonTest/kotlin/util/Coroutine.kt
|
||||||
src/iosTest/kotlin/util/Coroutine.kt
|
src/iosTest/kotlin/util/Coroutine.kt
|
||||||
src/jsTest/kotlin/util/Coroutine.kt
|
src/jsTest/kotlin/util/Coroutine.kt
|
||||||
src/jvmTest/kotlin/util/Coroutine.kt
|
src/jvmTest/kotlin/util/Coroutine.kt
|
||||||
src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/Authentication.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/auth/OAuth.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/Bytes.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
|
|
||||||
src/main/kotlin/org/openapitools/client/models/Apa.kt
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
class ApiKeyAuth(private val location: String, val paramName: String) : Authentication {
|
||||||
|
var apiKey: String? = null
|
||||||
|
var apiKeyPrefix: String? = null
|
||||||
|
|
||||||
|
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
|
||||||
|
val key: String = apiKey ?: return
|
||||||
|
val prefix: String? = apiKeyPrefix
|
||||||
|
val value: String = if (prefix != null) "$prefix $key" else key
|
||||||
|
when (location) {
|
||||||
|
"query" -> query[paramName] = listOf(value)
|
||||||
|
"header" -> headers[paramName] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
interface Authentication {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply authentication settings to header and query params.
|
||||||
|
*
|
||||||
|
* @param query Query parameters.
|
||||||
|
* @param headers Header parameters.
|
||||||
|
*/
|
||||||
|
fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
import io.ktor.util.InternalAPI
|
||||||
|
import io.ktor.util.encodeBase64
|
||||||
|
|
||||||
|
class HttpBasicAuth : Authentication {
|
||||||
|
var username: String? = null
|
||||||
|
var password: String? = null
|
||||||
|
|
||||||
|
@OptIn(InternalAPI::class)
|
||||||
|
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
|
||||||
|
if (username == null && password == null) return
|
||||||
|
val str = (username ?: "") + ":" + (password ?: "")
|
||||||
|
val auth = str.encodeBase64()
|
||||||
|
headers["Authorization"] = "Basic $auth"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
class HttpBearerAuth(private val scheme: String?) : Authentication {
|
||||||
|
var bearerToken: String? = null
|
||||||
|
|
||||||
|
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
|
||||||
|
val token: String = bearerToken ?: return
|
||||||
|
headers["Authorization"] = (if (scheme != null) upperCaseBearer(scheme)!! + " " else "") + token
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun upperCaseBearer(scheme: String): String? {
|
||||||
|
return if ("bearer".equals(scheme, ignoreCase = true)) "Bearer" else scheme
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
class OAuth : Authentication {
|
||||||
|
var accessToken: String? = null
|
||||||
|
|
||||||
|
override fun apply(query: MutableMap<String, List<String>>, headers: MutableMap<String, String>) {
|
||||||
|
val token: String = accessToken ?: return
|
||||||
|
headers["Authorization"] = "Bearer $token"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
typealias MultiValueMap = MutableMap<String,List<String>>
|
||||||
|
|
||||||
|
fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
|
||||||
|
"csv" -> ","
|
||||||
|
"tsv" -> "\t"
|
||||||
|
"pipe" -> "|"
|
||||||
|
"space" -> " "
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
|
||||||
|
val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
|
||||||
|
|
||||||
|
fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
|
||||||
|
= toMultiValue(items.asIterable(), collectionFormat, map)
|
||||||
|
|
||||||
|
fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
|
||||||
|
return when(collectionFormat) {
|
||||||
|
"multi" -> items.map(map)
|
||||||
|
else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import io.ktor.client.HttpClient
|
||||||
|
import io.ktor.client.HttpClientConfig
|
||||||
|
import io.ktor.client.engine.HttpClientEngine
|
||||||
|
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
||||||
|
import io.ktor.client.request.*
|
||||||
|
import io.ktor.client.request.forms.FormDataContent
|
||||||
|
import io.ktor.client.request.forms.MultiPartFormDataContent
|
||||||
|
import io.ktor.client.request.header
|
||||||
|
import io.ktor.client.request.parameter
|
||||||
|
import io.ktor.client.statement.HttpResponse
|
||||||
|
import io.ktor.serialization.kotlinx.json.json
|
||||||
|
import io.ktor.http.*
|
||||||
|
import io.ktor.http.content.PartData
|
||||||
|
import kotlin.Unit
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
import org.openapitools.client.auth.*
|
||||||
|
|
||||||
|
open class ApiClient(
|
||||||
|
private val baseUrl: String,
|
||||||
|
httpClientEngine: HttpClientEngine?,
|
||||||
|
httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
|
||||||
|
private val jsonBlock: Json
|
||||||
|
) {
|
||||||
|
|
||||||
|
private val clientConfig: (HttpClientConfig<*>) -> Unit by lazy {
|
||||||
|
{
|
||||||
|
it.install(ContentNegotiation) { json(jsonBlock) }
|
||||||
|
httpClientConfig?.invoke(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val client: HttpClient by lazy {
|
||||||
|
httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val authentications: kotlin.collections.Map<String, Authentication>? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val BASE_URL = "http://localhost"
|
||||||
|
val JSON_DEFAULT = Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
prettyPrint = true
|
||||||
|
isLenient = true
|
||||||
|
}
|
||||||
|
protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the username for the first HTTP basic authentication.
|
||||||
|
*
|
||||||
|
* @param username Username
|
||||||
|
*/
|
||||||
|
fun setUsername(username: String) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth?
|
||||||
|
?: throw Exception("No HTTP basic authentication configured")
|
||||||
|
auth.username = username
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the password for the first HTTP basic authentication.
|
||||||
|
*
|
||||||
|
* @param password Password
|
||||||
|
*/
|
||||||
|
fun setPassword(password: String) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth?
|
||||||
|
?: throw Exception("No HTTP basic authentication configured")
|
||||||
|
auth.password = password
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API key value for the first API key authentication.
|
||||||
|
*
|
||||||
|
* @param apiKey API key
|
||||||
|
* @param paramName The name of the API key parameter, or null or set the first key.
|
||||||
|
*/
|
||||||
|
fun setApiKey(apiKey: String, paramName: String? = null) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth?
|
||||||
|
?: throw Exception("No API key authentication configured")
|
||||||
|
auth.apiKey = apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API key prefix for the first API key authentication.
|
||||||
|
*
|
||||||
|
* @param apiKeyPrefix API key prefix
|
||||||
|
* @param paramName The name of the API key parameter, or null or set the first key.
|
||||||
|
*/
|
||||||
|
fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth?
|
||||||
|
?: throw Exception("No API key authentication configured")
|
||||||
|
auth.apiKeyPrefix = apiKeyPrefix
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the access token for the first OAuth2 authentication.
|
||||||
|
*
|
||||||
|
* @param accessToken Access token
|
||||||
|
*/
|
||||||
|
fun setAccessToken(accessToken: String) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is OAuth } as OAuth?
|
||||||
|
?: throw Exception("No OAuth2 authentication configured")
|
||||||
|
auth.accessToken = accessToken
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the access token for the first Bearer authentication.
|
||||||
|
*
|
||||||
|
* @param bearerToken The bearer token.
|
||||||
|
*/
|
||||||
|
fun setBearerToken(bearerToken: String) {
|
||||||
|
val auth = authentications?.values?.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth?
|
||||||
|
?: throw Exception("No Bearer authentication configured")
|
||||||
|
auth.bearerToken = bearerToken
|
||||||
|
}
|
||||||
|
|
||||||
|
protected suspend fun <T: Any?> multipartFormRequest(requestConfig: RequestConfig<T>, body: kotlin.collections.List<PartData>?, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||||
|
return request(requestConfig, MultiPartFormDataContent(body ?: listOf()), authNames)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected suspend fun <T: Any?> urlEncodedFormRequest(requestConfig: RequestConfig<T>, body: Parameters?, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||||
|
return request(requestConfig, FormDataContent(body ?: Parameters.Empty), authNames)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected suspend fun <T: Any?> jsonRequest(requestConfig: RequestConfig<T>, body: Any? = null, authNames: kotlin.collections.List<String>): HttpResponse = request(requestConfig, body, authNames)
|
||||||
|
|
||||||
|
protected suspend fun <T: Any?> request(requestConfig: RequestConfig<T>, body: Any? = null, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||||
|
requestConfig.updateForAuth<T>(authNames)
|
||||||
|
val headers = requestConfig.headers
|
||||||
|
|
||||||
|
return client.request {
|
||||||
|
this.url {
|
||||||
|
this.takeFrom(URLBuilder(baseUrl))
|
||||||
|
appendPath(requestConfig.path.trimStart('/').split('/'))
|
||||||
|
requestConfig.query.forEach { query ->
|
||||||
|
query.value.forEach { value ->
|
||||||
|
parameter(query.key, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.method = requestConfig.method.httpMethod
|
||||||
|
headers.filter { header -> !UNSAFE_HEADERS.contains(header.key) }.forEach { header -> this.header(header.key, header.value) }
|
||||||
|
if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH)) {
|
||||||
|
this.setBody(body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun <T: Any?> RequestConfig<T>.updateForAuth(authNames: kotlin.collections.List<String>) {
|
||||||
|
for (authName in authNames) {
|
||||||
|
val auth = authentications?.get(authName) ?: throw Exception("Authentication undefined: $authName")
|
||||||
|
auth.apply(query, headers)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun URLBuilder.appendPath(components: kotlin.collections.List<String>): URLBuilder = apply {
|
||||||
|
encodedPath = encodedPath.trimEnd('/') + components.joinToString("/", prefix = "/") { it.encodeURLQueryComponent() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private val RequestMethod.httpMethod: HttpMethod
|
||||||
|
get() = when (this) {
|
||||||
|
RequestMethod.DELETE -> HttpMethod.Delete
|
||||||
|
RequestMethod.GET -> HttpMethod.Get
|
||||||
|
RequestMethod.HEAD -> HttpMethod.Head
|
||||||
|
RequestMethod.PATCH -> HttpMethod.Patch
|
||||||
|
RequestMethod.PUT -> HttpMethod.Put
|
||||||
|
RequestMethod.POST -> HttpMethod.Post
|
||||||
|
RequestMethod.OPTIONS -> HttpMethod.Options
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.descriptors.*
|
||||||
|
import kotlinx.serialization.encoding.*
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Base64ByteArray(val value: ByteArray) {
|
||||||
|
@Serializer(Base64ByteArray::class)
|
||||||
|
companion object : KSerializer<Base64ByteArray> {
|
||||||
|
override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING)
|
||||||
|
override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64())
|
||||||
|
override fun deserialize(decoder: Decoder) = Base64ByteArray(decoder.decodeString().decodeBase64Bytes())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other == null || this::class != other::class) return false
|
||||||
|
other as Base64ByteArray
|
||||||
|
return value.contentEquals(other.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return value.contentHashCode()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Base64ByteArray(${hex(value)})"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import io.ktor.utils.io.core.*
|
||||||
|
import kotlin.experimental.and
|
||||||
|
|
||||||
|
private val digits = "0123456789abcdef".toCharArray()
|
||||||
|
private const val BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||||
|
private const val BASE64_MASK: Byte = 0x3f
|
||||||
|
private const val BASE64_PAD = '='
|
||||||
|
private val BASE64_INVERSE_ALPHABET = IntArray(256) { BASE64_ALPHABET.indexOf(it.toChar()) }
|
||||||
|
|
||||||
|
private fun String.toCharArray(): CharArray = CharArray(length) { get(it) }
|
||||||
|
private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it] = 0 }
|
||||||
|
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
|
||||||
|
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
|
||||||
|
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
|
||||||
|
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { dropLastWhile { it == BASE64_PAD } }.decodeBase64Bytes().readBytes()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/ktorio/ktor/blob/master/ktor-utils/common/src/io/ktor/util/Crypto.kt
|
||||||
|
*/
|
||||||
|
internal fun hex(bytes: ByteArray): String {
|
||||||
|
val result = CharArray(bytes.size * 2)
|
||||||
|
var resultIndex = 0
|
||||||
|
val digits = digits
|
||||||
|
|
||||||
|
for (element in bytes) {
|
||||||
|
val b = element.toInt() and 0xff
|
||||||
|
result[resultIndex++] = digits[b shr 4]
|
||||||
|
result[resultIndex++] = digits[b and 0x0f]
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.concatToString()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode bytes from HEX string. It should be no spaces and `0x` prefixes.
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/ktorio/ktor/blob/master/ktor-utils/common/src/io/ktor/util/Crypto.kt
|
||||||
|
*/
|
||||||
|
internal fun hex(s: String): ByteArray {
|
||||||
|
val result = ByteArray(s.length / 2)
|
||||||
|
for (idx in result.indices) {
|
||||||
|
val srcIdx = idx * 2
|
||||||
|
val high = s[srcIdx].toString().toInt(16) shl 4
|
||||||
|
val low = s[srcIdx + 1].toString().toInt(16)
|
||||||
|
result[idx] = (high or low).toByte()
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode [ByteReadPacket] in base64 format.
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
|
||||||
|
*/
|
||||||
|
private fun ByteReadPacket.encodeBase64(): String = buildString {
|
||||||
|
val data = ByteArray(3)
|
||||||
|
while (remaining > 0) {
|
||||||
|
val read = readAvailable(data)
|
||||||
|
data.clearFrom(read)
|
||||||
|
|
||||||
|
val padSize = (data.size - read) * 8 / 6
|
||||||
|
val chunk = ((data[0].toInt() and 0xFF) shl 16) or
|
||||||
|
((data[1].toInt() and 0xFF) shl 8) or
|
||||||
|
(data[2].toInt() and 0xFF)
|
||||||
|
|
||||||
|
for (index in data.size downTo padSize) {
|
||||||
|
val char = (chunk shr (6 * index)) and BASE64_MASK.toInt()
|
||||||
|
append(char.toBase64())
|
||||||
|
}
|
||||||
|
|
||||||
|
repeat(padSize) { append(BASE64_PAD) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode [ByteReadPacket] from base64 format
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
|
||||||
|
*/
|
||||||
|
private fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket {
|
||||||
|
val data = ByteArray(4)
|
||||||
|
|
||||||
|
while (remaining > 0) {
|
||||||
|
val read = readAvailable(data)
|
||||||
|
|
||||||
|
val chunk = data.foldIndexed(0) { index, result, current ->
|
||||||
|
result or (current.fromBase64().toInt() shl ((3 - index) * 6))
|
||||||
|
}
|
||||||
|
|
||||||
|
for (index in data.size - 2 downTo (data.size - read)) {
|
||||||
|
val origin = (chunk shr (8 * index)) and 0xff
|
||||||
|
writeByte(origin.toByte())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import io.ktor.http.Headers
|
||||||
|
import io.ktor.http.isSuccess
|
||||||
|
import io.ktor.util.reflect.TypeInfo
|
||||||
|
import io.ktor.util.reflect.typeInfo
|
||||||
|
|
||||||
|
open class HttpResponse<T : Any>(val response: io.ktor.client.statement.HttpResponse, val provider: BodyProvider<T>) {
|
||||||
|
val status: Int = response.status.value
|
||||||
|
val success: Boolean = response.status.isSuccess()
|
||||||
|
val headers: Map<String, List<String>> = response.headers.mapEntries()
|
||||||
|
suspend fun body(): T = provider.body(response)
|
||||||
|
suspend fun <V : Any> typedBody(type: TypeInfo): V = provider.typedBody(response, type)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private fun Headers.mapEntries(): Map<String, List<String>> {
|
||||||
|
val result = mutableMapOf<String, List<String>>()
|
||||||
|
entries().forEach { result[it.key] = it.value }
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BodyProvider<T : Any> {
|
||||||
|
suspend fun body(response: io.ktor.client.statement.HttpResponse): T
|
||||||
|
suspend fun <V : Any> typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V
|
||||||
|
}
|
||||||
|
|
||||||
|
class TypedBodyProvider<T : Any>(private val type: TypeInfo) : BodyProvider<T> {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
override suspend fun body(response: io.ktor.client.statement.HttpResponse): T =
|
||||||
|
response.call.body(type) as T
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
override suspend fun <V : Any> typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V =
|
||||||
|
response.call.body(type) as V
|
||||||
|
}
|
||||||
|
|
||||||
|
class MappedBodyProvider<S : Any, T : Any>(private val provider: BodyProvider<S>, private val block: S.() -> T) : BodyProvider<T> {
|
||||||
|
override suspend fun body(response: io.ktor.client.statement.HttpResponse): T =
|
||||||
|
block(provider.body(response))
|
||||||
|
|
||||||
|
override suspend fun <V : Any> typedBody(response: io.ktor.client.statement.HttpResponse, type: TypeInfo): V =
|
||||||
|
provider.typedBody(response, type)
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T : Any> io.ktor.client.statement.HttpResponse.wrap(): HttpResponse<T> =
|
||||||
|
HttpResponse(this, TypedBodyProvider(typeInfo<T>()))
|
||||||
|
|
||||||
|
fun <T : Any, V : Any> HttpResponse<T>.map(block: T.() -> V): HttpResponse<V> =
|
||||||
|
HttpResponse(response, MappedBodyProvider(provider, block))
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.descriptors.*
|
||||||
|
import kotlinx.serialization.encoding.*
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class OctetByteArray(val value: ByteArray) {
|
||||||
|
@Serializer(OctetByteArray::class)
|
||||||
|
companion object : KSerializer<OctetByteArray> {
|
||||||
|
override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING)
|
||||||
|
override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value))
|
||||||
|
override fun deserialize(decoder: Decoder) = OctetByteArray(hex(decoder.decodeString()))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other == null || this::class != other::class) return false
|
||||||
|
other as OctetByteArray
|
||||||
|
return value.contentEquals(other.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return value.contentHashCode()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "OctetByteArray(${hex(value)})"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a config object for a given part of a multi-part request.
|
||||||
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
|
* multi-valued headers as csv-only.
|
||||||
|
*/
|
||||||
|
data class PartConfig<T>(
|
||||||
|
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||||
|
val body: T? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a config object for a given request.
|
||||||
|
* NOTE: This object doesn't include 'body' because it
|
||||||
|
* allows for caching of the constructed object
|
||||||
|
* for many request definitions.
|
||||||
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
|
* multi-valued headers as csv-only.
|
||||||
|
*/
|
||||||
|
data class RequestConfig<T>(
|
||||||
|
val method: RequestMethod,
|
||||||
|
val path: String,
|
||||||
|
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||||
|
val query: MutableMap<String, List<String>> = mutableMapOf(),
|
||||||
|
val requiresAuthentication: Boolean,
|
||||||
|
val body: T? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides enumerated HTTP verbs
|
||||||
|
*/
|
||||||
|
enum class RequestMethod {
|
||||||
|
GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT
|
||||||
|
}
|
||||||
@@ -56,5 +56,5 @@ src/gen/java/org/openapitools/model/User.java
|
|||||||
src/gen/java/org/openapitools/model/XmlItem.java
|
src/gen/java/org/openapitools/model/XmlItem.java
|
||||||
src/main/docker/Dockerfile.jvm
|
src/main/docker/Dockerfile.jvm
|
||||||
src/main/docker/Dockerfile.native
|
src/main/docker/Dockerfile.native
|
||||||
src/main/openapi/openapi.yaml
|
src/main/resources/META-INF/openapi.yaml
|
||||||
src/main/resources/application.properties
|
src/main/resources/application.properties
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
<surefire-plugin.version>2.22.1</surefire-plugin.version>
|
<surefire-plugin.version>2.22.1</surefire-plugin.version>
|
||||||
<javax.ws.rs-version>2.1.1</javax.ws.rs-version>
|
<javax.ws.rs-version>2.1.1</javax.ws.rs-version>
|
||||||
<javax.annotation-api-version>1.3.2</javax.annotation-api-version>
|
<javax.annotation-api-version>1.3.2</javax.annotation-api-version>
|
||||||
<io.swagger.annotations.version>1.6.10</io.swagger.annotations.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -65,12 +64,6 @@
|
|||||||
<artifactId>javax.annotation-api</artifactId>
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
<version>${javax.annotation-api-version}</version>
|
<version>${javax.annotation-api-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.swagger</groupId>
|
|
||||||
<artifactId>swagger-annotations</artifactId>
|
|
||||||
<version>${io.swagger.annotations.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import javax.ws.rs.*;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -55,7 +54,6 @@ import javax.validation.Valid;
|
|||||||
scheme = "basic"
|
scheme = "basic"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@Api(description = "the another-fake API")
|
|
||||||
@Path("/another-fake/dummy")
|
@Path("/another-fake/dummy")
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
||||||
public class AnotherFakeApi {
|
public class AnotherFakeApi {
|
||||||
@@ -63,10 +61,6 @@ public class AnotherFakeApi {
|
|||||||
@PATCH
|
@PATCH
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Client.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "call123testSpecialTags", summary = "To test special tags", description = "To test special tags and operation ID starting with number")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "call123testSpecialTags", summary = "To test special tags", description = "To test special tags and operation ID starting with number")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="$another-fake?")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="$another-fake?")
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import javax.ws.rs.*;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -65,7 +64,6 @@ import javax.validation.Valid;
|
|||||||
scheme = "basic"
|
scheme = "basic"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@Api(description = "the fake API")
|
|
||||||
@Path("/fake")
|
@Path("/fake")
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
||||||
public class FakeApi {
|
public class FakeApi {
|
||||||
@@ -73,10 +71,6 @@ public class FakeApi {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/create_xml_item")
|
@Path("/create_xml_item")
|
||||||
@Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" })
|
@Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" })
|
||||||
@ApiOperation(value = "creates an XmlItem", notes = "this route creates an XmlItem", response = Void.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "createXmlItem", summary = "creates an XmlItem", description = "this route creates an XmlItem")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "createXmlItem", summary = "creates an XmlItem", description = "this route creates an XmlItem")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -92,10 +86,6 @@ public class FakeApi {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/outer/boolean")
|
@Path("/outer/boolean")
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
@ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "Output boolean", response = Boolean.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "fakeOuterBooleanSerialize", summary = "", description = "Test serialization of outer boolean types")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "fakeOuterBooleanSerialize", summary = "", description = "Test serialization of outer boolean types")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -111,10 +101,6 @@ public class FakeApi {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/outer/composite")
|
@Path("/outer/composite")
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
@ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "fakeOuterCompositeSerialize", summary = "", description = "Test serialization of object with outer number type")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "fakeOuterCompositeSerialize", summary = "", description = "Test serialization of object with outer number type")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -130,10 +116,6 @@ public class FakeApi {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/outer/number")
|
@Path("/outer/number")
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
@ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "Output number", response = BigDecimal.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "fakeOuterNumberSerialize", summary = "", description = "Test serialization of outer number types")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "fakeOuterNumberSerialize", summary = "", description = "Test serialization of outer number types")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -149,10 +131,6 @@ public class FakeApi {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/outer/string")
|
@Path("/outer/string")
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
@ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "Output string", response = String.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "fakeOuterStringSerialize", summary = "", description = "Test serialization of outer string types")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "fakeOuterStringSerialize", summary = "", description = "Test serialization of outer string types")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -168,10 +146,6 @@ public class FakeApi {
|
|||||||
@PUT
|
@PUT
|
||||||
@Path("/body-with-file-schema")
|
@Path("/body-with-file-schema")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "Success", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testBodyWithFileSchema", summary = "", description = "For this test, the body for this request much reference a schema named `File`.")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testBodyWithFileSchema", summary = "", description = "For this test, the body for this request much reference a schema named `File`.")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -187,10 +161,6 @@ public class FakeApi {
|
|||||||
@PUT
|
@PUT
|
||||||
@Path("/body-with-query-params")
|
@Path("/body-with-query-params")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@ApiOperation(value = "", notes = "", response = Void.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "Success", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testBodyWithQueryParams", summary = "", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testBodyWithQueryParams", summary = "", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -206,10 +176,6 @@ public class FakeApi {
|
|||||||
@PATCH
|
@PATCH
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Client.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testClientModel", summary = "To test \"client\" model", description = "To test \"client\" model")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testClientModel", summary = "To test \"client\" model", description = "To test \"client\" model")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -224,14 +190,6 @@ public class FakeApi {
|
|||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", response = Void.class, authorizations = {
|
|
||||||
|
|
||||||
@Authorization(value = "http_basic_test")
|
|
||||||
}, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "User not found", response = Void.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "http_basic_test")
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "http_basic_test")
|
||||||
})
|
})
|
||||||
@@ -251,14 +209,6 @@ public class FakeApi {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
@ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake" })
|
|
||||||
@io.swagger.annotations.ApiImplicitParams({
|
|
||||||
@io.swagger.annotations.ApiImplicitParam(name = "enum_header_string", value = "Header parameter enum test (string)", dataType = "String", paramType = "header")
|
|
||||||
})
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "Not found", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testEnumParameters", summary = "To test enum parameters", description = "To test enum parameters")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testEnumParameters", summary = "To test enum parameters", description = "To test enum parameters")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -270,15 +220,11 @@ public class FakeApi {
|
|||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Header parameter enum test (string array)") List<String> enumHeaderStringArray,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Query parameter enum test (string array)") List<String> enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List<String> enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) {
|
public Response testEnumParameters(@HeaderParam("enum_header_string_array") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Header parameter enum test (string array)") List<String> enumHeaderStringArray,@QueryParam("enum_query_string_array") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Query parameter enum test (string array)") List<String> enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List<String> enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", response = Void.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 400, message = "Something wrong", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testGroupParameters", summary = "Fake endpoint to test group parameters (optional)", description = "Fake endpoint to test group parameters (optional)")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testGroupParameters", summary = "Fake endpoint to test group parameters (optional)", description = "Fake endpoint to test group parameters (optional)")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -287,17 +233,13 @@ public class FakeApi {
|
|||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response testGroupParameters(@QueryParam("required_string_group") @NotNull @ApiParam("Required String in group parameters") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Required String in group parameters") Integer requiredStringGroup,@HeaderParam("required_boolean_group") @NotNull @ApiParam("Required Boolean in group parameters") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Required Boolean in group parameters") Boolean requiredBooleanGroup,@QueryParam("required_int64_group") @NotNull @ApiParam("Required Integer in group parameters") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Required Integer in group parameters") Long requiredInt64Group,@QueryParam("string_group") @ApiParam("String in group parameters") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="String in group parameters") Integer stringGroup,@HeaderParam("boolean_group") @ApiParam("Boolean in group parameters") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Boolean in group parameters") Boolean booleanGroup,@QueryParam("int64_group") @ApiParam("Integer in group parameters") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Integer in group parameters") Long int64Group) {
|
public Response testGroupParameters(@QueryParam("required_string_group") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Required String in group parameters") Integer requiredStringGroup,@HeaderParam("required_boolean_group") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Required Boolean in group parameters") Boolean requiredBooleanGroup,@QueryParam("required_int64_group") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Required Integer in group parameters") Long requiredInt64Group,@QueryParam("string_group") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="String in group parameters") Integer stringGroup,@HeaderParam("boolean_group") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Boolean in group parameters") Boolean booleanGroup,@QueryParam("int64_group") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Integer in group parameters") Long int64Group) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/inline-additionalProperties")
|
@Path("/inline-additionalProperties")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testInlineAdditionalProperties", summary = "test inline additionalProperties", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testInlineAdditionalProperties", summary = "test inline additionalProperties", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -313,10 +255,6 @@ public class FakeApi {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/jsonFormData")
|
@Path("/jsonFormData")
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
@ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testJsonFormData", summary = "test json serialization of form data", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testJsonFormData", summary = "test json serialization of form data", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -331,10 +269,6 @@ public class FakeApi {
|
|||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/test-query-parameters")
|
@Path("/test-query-parameters")
|
||||||
@ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "Success", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testQueryParameterCollectionFormat", summary = "", description = "To test the collection format in query parameters")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "testQueryParameterCollectionFormat", summary = "", description = "To test the collection format in query parameters")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="fake")
|
||||||
@@ -351,14 +285,6 @@ public class FakeApi {
|
|||||||
@Path("/{petId}/uploadImageWithRequiredFile")
|
@Path("/{petId}/uploadImageWithRequiredFile")
|
||||||
@Consumes({ "multipart/form-data" })
|
@Consumes({ "multipart/form-data" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "uploads an image (required)", notes = "", response = ModelApiResponse.class, authorizations = {
|
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets") })
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
||||||
})
|
})
|
||||||
@@ -369,7 +295,7 @@ public class FakeApi {
|
|||||||
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class))
|
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response uploadFileWithRequiredFile(@PathParam("petId") @ApiParam("ID of pet to update") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to update") Long petId, @FormParam(value = "requiredFile") InputStream requiredFileInputStream,@FormParam(value = "additionalMetadata") String additionalMetadata) {
|
public Response uploadFileWithRequiredFile(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to update") Long petId, @FormParam(value = "requiredFile") InputStream requiredFileInputStream,@FormParam(value = "additionalMetadata") String additionalMetadata) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import javax.ws.rs.*;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -55,7 +54,6 @@ import javax.validation.Valid;
|
|||||||
scheme = "basic"
|
scheme = "basic"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@Api(description = "the fake_classname_test API")
|
|
||||||
@Path("/fake_classname_test")
|
@Path("/fake_classname_test")
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
||||||
public class FakeClassnameTestApi {
|
public class FakeClassnameTestApi {
|
||||||
@@ -63,13 +61,6 @@ public class FakeClassnameTestApi {
|
|||||||
@PATCH
|
@PATCH
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = {
|
|
||||||
|
|
||||||
@Authorization(value = "api_key_query")
|
|
||||||
}, tags={ "fake_classname_tags 123#$%^" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Client.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "api_key_query")
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "api_key_query")
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import javax.ws.rs.*;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -58,22 +57,12 @@ import javax.validation.Valid;
|
|||||||
scheme = "basic"
|
scheme = "basic"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@Api(description = "the pet API")
|
|
||||||
@Path("/pet")
|
@Path("/pet")
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
||||||
public class PetApi {
|
public class PetApi {
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
@ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
|
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets") })
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class),
|
|
||||||
@ApiResponse(code = 405, message = "Invalid input", response = Void.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
||||||
})
|
})
|
||||||
@@ -93,18 +82,6 @@ public class PetApi {
|
|||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{petId}")
|
@Path("/{petId}")
|
||||||
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
|
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets") })
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@io.swagger.annotations.ApiImplicitParams({
|
|
||||||
@io.swagger.annotations.ApiImplicitParam(name = "api_key", value = "", dataType = "String", paramType = "header")
|
|
||||||
})
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid pet value", response = Void.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
||||||
})
|
})
|
||||||
@@ -118,22 +95,13 @@ public class PetApi {
|
|||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response deletePet(@PathParam("petId") @ApiParam("Pet id to delete") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Pet id to delete") Long petId) {
|
public Response deletePet(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Pet id to delete") Long petId) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/findByStatus")
|
@Path("/findByStatus")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets") })
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid status value", response = Void.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
||||||
})
|
})
|
||||||
@@ -149,22 +117,13 @@ public class PetApi {
|
|||||||
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response findPetsByStatus(@QueryParam("status") @NotNull @ApiParam("Status values that need to be considered for filter") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Status values that need to be considered for filter") List<String> status) {
|
public Response findPetsByStatus(@QueryParam("status") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Status values that need to be considered for filter") List<String> status) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/findByTags")
|
@Path("/findByTags")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "Set", authorizations = {
|
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets") })
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid tag value", response = Void.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
||||||
})
|
})
|
||||||
@@ -180,22 +139,13 @@ public class PetApi {
|
|||||||
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response findPetsByTags(@QueryParam("tags") @NotNull @ApiParam("Tags to filter by") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Tags to filter by") Set<String> tags) {
|
public Response findPetsByTags(@QueryParam("tags") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Tags to filter by") Set<String> tags) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{petId}")
|
@Path("/{petId}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
|
||||||
|
|
||||||
@Authorization(value = "api_key")
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "Pet not found", response = Void.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "api_key")
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "api_key")
|
||||||
})
|
})
|
||||||
@@ -215,23 +165,12 @@ public class PetApi {
|
|||||||
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response getPetById(@PathParam("petId") @ApiParam("ID of pet to return") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to return") Long petId) {
|
public Response getPetById(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to return") Long petId) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
@ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {
|
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets") })
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "Pet not found", response = Void.class),
|
|
||||||
@ApiResponse(code = 405, message = "Validation exception", response = Void.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
||||||
})
|
})
|
||||||
@@ -258,14 +197,6 @@ public class PetApi {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/{petId}")
|
@Path("/{petId}")
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
|
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets") })
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 405, message = "Invalid input", response = Void.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
||||||
})
|
})
|
||||||
@@ -276,7 +207,7 @@ public class PetApi {
|
|||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response updatePetWithForm(@PathParam("petId") @ApiParam("ID of pet that needs to be updated") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet that needs to be updated") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) {
|
public Response updatePetWithForm(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet that needs to be updated") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,14 +215,6 @@ public class PetApi {
|
|||||||
@Path("/{petId}/uploadImage")
|
@Path("/{petId}/uploadImage")
|
||||||
@Consumes({ "multipart/form-data" })
|
@Consumes({ "multipart/form-data" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets") })
|
|
||||||
}, tags={ "pet" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class)
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" })
|
||||||
})
|
})
|
||||||
@@ -302,7 +225,7 @@ public class PetApi {
|
|||||||
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class))
|
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response uploadFile(@PathParam("petId") @ApiParam("ID of pet to update") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to update") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream _fileInputStream) {
|
public Response uploadFile(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to update") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream _fileInputStream) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import javax.ws.rs.*;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -56,18 +55,12 @@ import javax.validation.Valid;
|
|||||||
scheme = "basic"
|
scheme = "basic"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@Api(description = "the store API")
|
|
||||||
@Path("/store")
|
@Path("/store")
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
||||||
public class StoreApi {
|
public class StoreApi {
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/order/{order_id}")
|
@Path("/order/{order_id}")
|
||||||
@ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "Order not found", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "deleteOrder", summary = "Delete purchase order by ID", description = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "deleteOrder", summary = "Delete purchase order by ID", description = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="store")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="store")
|
||||||
@@ -79,20 +72,13 @@ public class StoreApi {
|
|||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response deleteOrder(@PathParam("order_id") @ApiParam("ID of the order that needs to be deleted") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of the order that needs to be deleted") String orderId) {
|
public Response deleteOrder(@PathParam("order_id") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of the order that needs to be deleted") String orderId) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/inventory")
|
@Path("/inventory")
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
|
|
||||||
|
|
||||||
@Authorization(value = "api_key")
|
|
||||||
}, tags={ "store" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map")
|
|
||||||
})
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={
|
||||||
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "api_key")
|
@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "api_key")
|
||||||
})
|
})
|
||||||
@@ -110,12 +96,6 @@ public class StoreApi {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/order/{order_id}")
|
@Path("/order/{order_id}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions", response = Order.class, tags={ "store" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "Order not found", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "getOrderById", summary = "Find purchase order by ID", description = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "getOrderById", summary = "Find purchase order by ID", description = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="store")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="store")
|
||||||
@@ -133,18 +113,13 @@ public class StoreApi {
|
|||||||
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) @ApiParam("ID of pet that needs to be fetched") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet that needs to be fetched") Long orderId) {
|
public Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet that needs to be fetched") Long orderId) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/order")
|
@Path("/order")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid Order", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "placeOrder", summary = "Place an order for a pet", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "placeOrder", summary = "Place an order for a pet", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="store")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="store")
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import javax.ws.rs.*;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -56,16 +55,11 @@ import javax.validation.Valid;
|
|||||||
scheme = "basic"
|
scheme = "basic"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@Api(description = "the user API")
|
|
||||||
@Path("/user")
|
@Path("/user")
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
||||||
public class UserApi {
|
public class UserApi {
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "createUser", summary = "Create user", description = "This can only be done by the logged in user.")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "createUser", summary = "Create user", description = "This can only be done by the logged in user.")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
||||||
@@ -80,10 +74,6 @@ public class UserApi {
|
|||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/createWithArray")
|
@Path("/createWithArray")
|
||||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "createUsersWithArrayInput", summary = "Creates list of users with given input array", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "createUsersWithArrayInput", summary = "Creates list of users with given input array", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
||||||
@@ -98,10 +88,6 @@ public class UserApi {
|
|||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/createWithList")
|
@Path("/createWithList")
|
||||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "createUsersWithListInput", summary = "Creates list of users with given input array", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "createUsersWithListInput", summary = "Creates list of users with given input array", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
||||||
@@ -116,11 +102,6 @@ public class UserApi {
|
|||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{username}")
|
@Path("/{username}")
|
||||||
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "User not found", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "deleteUser", summary = "Delete user", description = "This can only be done by the logged in user.")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "deleteUser", summary = "Delete user", description = "This can only be done by the logged in user.")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
||||||
@@ -132,19 +113,13 @@ public class UserApi {
|
|||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response deleteUser(@PathParam("username") @ApiParam("The name that needs to be deleted") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The name that needs to be deleted") String username) {
|
public Response deleteUser(@PathParam("username") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The name that needs to be deleted") String username) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{username}")
|
@Path("/{username}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = User.class),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "User not found", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "getUserByName", summary = "Get user by user name", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "getUserByName", summary = "Get user by user name", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
||||||
@@ -162,18 +137,13 @@ public class UserApi {
|
|||||||
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response getUserByName(@PathParam("username") @ApiParam("The name that needs to be fetched. Use user1 for testing.") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The name that needs to be fetched. Use user1 for testing.") String username) {
|
public Response getUserByName(@PathParam("username") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The name that needs to be fetched. Use user1 for testing.") String username) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/login")
|
@Path("/login")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = String.class),
|
|
||||||
@ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "loginUser", summary = "Logs user into the system", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "loginUser", summary = "Logs user into the system", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
||||||
@@ -190,16 +160,12 @@ public class UserApi {
|
|||||||
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response loginUser(@QueryParam("username") @NotNull @ApiParam("The user name for login") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The user name for login") String username,@QueryParam("password") @NotNull @ApiParam("The password for login in clear text") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The password for login in clear text") String password) {
|
public Response loginUser(@QueryParam("username") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The user name for login") String username,@QueryParam("password") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The password for login in clear text") String password) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/logout")
|
@Path("/logout")
|
||||||
@ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "logoutUser", summary = "Logs out current logged in user session", description = "")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "logoutUser", summary = "Logs out current logged in user session", description = "")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
||||||
@@ -214,11 +180,6 @@ public class UserApi {
|
|||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/{username}")
|
@Path("/{username}")
|
||||||
@ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" })
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class),
|
|
||||||
@ApiResponse(code = 404, message = "User not found", response = Void.class)
|
|
||||||
})
|
|
||||||
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "updateUser", summary = "Updated user", description = "This can only be done by the logged in user.")
|
@org.eclipse.microprofile.openapi.annotations.Operation(operationId = "updateUser", summary = "Updated user", description = "This can only be done by the logged in user.")
|
||||||
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
@org.eclipse.microprofile.openapi.annotations.tags.Tag(name="user")
|
||||||
@@ -230,7 +191,7 @@ public class UserApi {
|
|||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
public Response updateUser(@PathParam("username") @ApiParam("name that need to be deleted") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="name that need to be deleted") String username,@Valid @NotNull User body) {
|
public Response updateUser(@PathParam("username") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="name that need to be deleted") String username,@Valid @NotNull User body) {
|
||||||
return Response.ok().entity("magic!").build();
|
return Response.ok().entity("magic!").build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -31,7 +28,6 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -9,7 +7,6 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -32,7 +29,6 @@ public class AdditionalPropertiesArray extends HashMap<String, List> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -31,7 +28,6 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,7 +8,6 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -60,7 +57,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("map_string")
|
@JsonProperty("map_string")
|
||||||
public Map<String, String> getMapString() {
|
public Map<String, String> getMapString() {
|
||||||
@@ -96,7 +92,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("map_number")
|
@JsonProperty("map_number")
|
||||||
public Map<String, BigDecimal> getMapNumber() {
|
public Map<String, BigDecimal> getMapNumber() {
|
||||||
@@ -132,7 +127,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("map_integer")
|
@JsonProperty("map_integer")
|
||||||
public Map<String, Integer> getMapInteger() {
|
public Map<String, Integer> getMapInteger() {
|
||||||
@@ -168,7 +162,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("map_boolean")
|
@JsonProperty("map_boolean")
|
||||||
public Map<String, Boolean> getMapBoolean() {
|
public Map<String, Boolean> getMapBoolean() {
|
||||||
@@ -204,7 +197,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("map_array_integer")
|
@JsonProperty("map_array_integer")
|
||||||
public Map<String, List<Integer>> getMapArrayInteger() {
|
public Map<String, List<Integer>> getMapArrayInteger() {
|
||||||
@@ -240,7 +232,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("map_array_anytype")
|
@JsonProperty("map_array_anytype")
|
||||||
public Map<String, List<Object>> getMapArrayAnytype() {
|
public Map<String, List<Object>> getMapArrayAnytype() {
|
||||||
@@ -276,7 +267,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("map_map_string")
|
@JsonProperty("map_map_string")
|
||||||
public Map<String, Map<String, String>> getMapMapString() {
|
public Map<String, Map<String, String>> getMapMapString() {
|
||||||
@@ -312,7 +302,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("map_map_anytype")
|
@JsonProperty("map_map_anytype")
|
||||||
public Map<String, Map<String, Object>> getMapMapAnytype() {
|
public Map<String, Map<String, Object>> getMapMapAnytype() {
|
||||||
@@ -348,7 +337,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("anytype_1")
|
@JsonProperty("anytype_1")
|
||||||
public Object getAnytype1() {
|
public Object getAnytype1() {
|
||||||
@@ -368,7 +356,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("anytype_2")
|
@JsonProperty("anytype_2")
|
||||||
public Object getAnytype2() {
|
public Object getAnytype2() {
|
||||||
@@ -388,7 +375,6 @@ public class AdditionalPropertiesClass implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("anytype_3")
|
@JsonProperty("anytype_3")
|
||||||
public Object getAnytype3() {
|
public Object getAnytype3() {
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -31,7 +28,6 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -9,7 +7,6 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -32,7 +29,6 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -31,7 +28,6 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -31,7 +28,6 @@ public class AdditionalPropertiesString extends HashMap<String, String> implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ package org.openapitools.model;
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -47,7 +44,6 @@ public class Animal implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(required = true, value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(required = true, description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(required = true, description = "")
|
||||||
@JsonProperty("className")
|
@JsonProperty("className")
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -68,7 +64,6 @@ public class Animal implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("color")
|
@JsonProperty("color")
|
||||||
public String getColor() {
|
public String getColor() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -9,7 +7,6 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -39,7 +36,6 @@ public class ArrayOfArrayOfNumberOnly implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("ArrayArrayNumber")
|
@JsonProperty("ArrayArrayNumber")
|
||||||
public List<List<BigDecimal>> getArrayArrayNumber() {
|
public List<List<BigDecimal>> getArrayArrayNumber() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -9,7 +7,6 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -39,7 +36,6 @@ public class ArrayOfNumberOnly implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("ArrayNumber")
|
@JsonProperty("ArrayNumber")
|
||||||
public List<BigDecimal> getArrayNumber() {
|
public List<BigDecimal> getArrayNumber() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.openapitools.model.ReadOnlyFirst;
|
import org.openapitools.model.ReadOnlyFirst;
|
||||||
@@ -9,7 +7,6 @@ import java.io.Serializable;
|
|||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -43,7 +40,6 @@ public class ArrayTest implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("array_of_string")
|
@JsonProperty("array_of_string")
|
||||||
public List<String> getArrayOfString() {
|
public List<String> getArrayOfString() {
|
||||||
@@ -79,7 +75,6 @@ public class ArrayTest implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("array_array_of_integer")
|
@JsonProperty("array_array_of_integer")
|
||||||
public List<List<Long>> getArrayArrayOfInteger() {
|
public List<List<Long>> getArrayArrayOfInteger() {
|
||||||
@@ -115,7 +110,6 @@ public class ArrayTest implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("array_array_of_model")
|
@JsonProperty("array_array_of_model")
|
||||||
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
|
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import org.openapitools.model.Cat;
|
import org.openapitools.model.Cat;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -85,7 +82,6 @@ public class BigCat extends Cat implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("kind")
|
@JsonProperty("kind")
|
||||||
public KindEnum getKind() {
|
public KindEnum getKind() {
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -46,7 +43,6 @@ public class Capitalization implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("smallCamel")
|
@JsonProperty("smallCamel")
|
||||||
public String getSmallCamel() {
|
public String getSmallCamel() {
|
||||||
@@ -66,7 +62,6 @@ public class Capitalization implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("CapitalCamel")
|
@JsonProperty("CapitalCamel")
|
||||||
public String getCapitalCamel() {
|
public String getCapitalCamel() {
|
||||||
@@ -86,7 +81,6 @@ public class Capitalization implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("small_Snake")
|
@JsonProperty("small_Snake")
|
||||||
public String getSmallSnake() {
|
public String getSmallSnake() {
|
||||||
@@ -106,7 +100,6 @@ public class Capitalization implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("Capital_Snake")
|
@JsonProperty("Capital_Snake")
|
||||||
public String getCapitalSnake() {
|
public String getCapitalSnake() {
|
||||||
@@ -126,7 +119,6 @@ public class Capitalization implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("SCA_ETH_Flow_Points")
|
@JsonProperty("SCA_ETH_Flow_Points")
|
||||||
public String getScAETHFlowPoints() {
|
public String getScAETHFlowPoints() {
|
||||||
@@ -147,7 +139,6 @@ public class Capitalization implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "Name of the pet ")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "Name of the pet ")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "Name of the pet ")
|
||||||
@JsonProperty("ATT_NAME")
|
@JsonProperty("ATT_NAME")
|
||||||
public String getATTNAME() {
|
public String getATTNAME() {
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import org.openapitools.model.Animal;
|
import org.openapitools.model.Animal;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -38,7 +35,6 @@ public class Cat extends Animal implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("declawed")
|
@JsonProperty("declawed")
|
||||||
public Boolean getDeclawed() {
|
public Boolean getDeclawed() {
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -38,7 +35,6 @@ public class Category implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
@@ -58,7 +54,6 @@ public class Category implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(required = true, value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(required = true, description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(required = true, description = "")
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
package org.openapitools.model;
|
package org.openapitools.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
@@ -16,7 +13,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
/**
|
/**
|
||||||
* Model for testing model with \"_class\" property
|
* Model for testing model with \"_class\" property
|
||||||
**/
|
**/
|
||||||
@ApiModel(description = "Model for testing model with \"_class\" property")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description="Model for testing model with \"_class\" property")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description="Model for testing model with \"_class\" property")
|
||||||
@JsonTypeName("ClassModel")
|
@JsonTypeName("ClassModel")
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
|
||||||
@@ -38,7 +35,6 @@ public class ClassModel implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "")
|
|
||||||
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
@org.eclipse.microprofile.openapi.annotations.media.Schema(description = "")
|
||||||
@JsonProperty("_class")
|
@JsonProperty("_class")
|
||||||
public String getPropertyClass() {
|
public String getPropertyClass() {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user