diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache index 485b0bed9b59..33c596d09599 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache @@ -17,7 +17,13 @@ import {{packageName}}.infrastructure.Success import {{packageName}}.infrastructure.toMultiValue {{#operations}} -{{#nonPublicApi}}internal {{/nonPublicApi}}class {{classname}}(basePath: kotlin.String = "{{{basePath}}}") : ApiClient(basePath) { +{{#nonPublicApi}}internal {{/nonPublicApi}}class {{classname}}(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("{{packageName}}.baseUrl", "{{{basePath}}}") + } + } {{#operation}} /** diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache index eab46f77ad48..723be88b00a3 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache @@ -11,9 +11,16 @@ import retrofit2.converter.moshi.MoshiConverterFactory {{/moshi}} {{#nonPublicApi}}internal {{/nonPublicApi}}class ApiClient( - private var baseUrl: String = "{{{basePath}}}", + private var baseUrl: String = defaultBasePath, private var okHttpClient: OkHttpClient ) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("{{packageName}}.baseUrl", "{{{basePath}}}") + } + } + init { normalizeBaseUrl() } diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a2698dc47ea0..e1f24025fedd 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1399a0ca1cf7..08822c67e32a 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a7d99762fd8c..1e6e81fc1e91 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a2698dc47ea0..e1f24025fedd 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1399a0ca1cf7..08822c67e32a 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a7d99762fd8c..1e6e81fc1e91 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index d5906cbd6564..d6470e48d721 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1399a0ca1cf7..08822c67e32a 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a7d99762fd8c..1e6e81fc1e91 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a2698dc47ea0..e1f24025fedd 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1399a0ca1cf7..08822c67e32a 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a7d99762fd8c..1e6e81fc1e91 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 50770e4c7451..a2f79242657d 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -internal class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 893601a3220a..4f8898adf9b3 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -internal class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index d486ee7dc52b..eba7b8392e8d 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -internal class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index cf797f67c9f4..cdb5ac18715b 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a2deaaa89d1d..b9dd7b38f59b 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index d4f2f9f8c249..14ce7aa5f54a 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a2698dc47ea0..e1f24025fedd 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1399a0ca1cf7..08822c67e32a 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a7d99762fd8c..1e6e81fc1e91 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b539fda7438d..2b657de46adb 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -6,9 +6,16 @@ import retrofit2.converter.scalars.ScalarsConverterFactory import retrofit2.converter.moshi.MoshiConverterFactory class ApiClient( - private var baseUrl: String = "http://petstore.swagger.io/v2", + private var baseUrl: String = defaultBasePath, private var okHttpClient: OkHttpClient ) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } + init { normalizeBaseUrl() } diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 93269dced25d..926e3497f7bd 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1399a0ca1cf7..08822c67e32a 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a7d99762fd8c..1e6e81fc1e91 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a2698dc47ea0..e1f24025fedd 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1399a0ca1cf7..08822c67e32a 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a7d99762fd8c..1e6e81fc1e91 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a2698dc47ea0..e1f24025fedd 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1399a0ca1cf7..08822c67e32a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a7d99762fd8c..1e6e81fc1e91 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,13 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") + } + } /** * Create user