forked from loafle/openapi-generator-original
Added useSettingsGradle property in kotlin-client. (#15003)
* Added useSettingsGradle property in kotlin-client. * kotlin docs update. - add kotlinx_serialization in serializationLibrary.
This commit is contained in:
@@ -38,7 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true. This option is currently supported only when using jaxrs-spec library.| |false|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'| |moshi|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|
||||
@@ -40,7 +40,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|reactive|use coroutines for reactive behavior| |false|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'| |moshi|
|
||||
|serverPort|configuration the port in which the sever is to run on| |8080|
|
||||
|serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false|
|
||||
|serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false|
|
||||
|
||||
@@ -28,7 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|packageName|Generated artifact package name.| |org.openapitools|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'| |moshi|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|
||||
@@ -37,7 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|requestDateConverter|JVM-Option. Defines in how to handle date-time objects that are used for a request (as query or parameter)|<dl><dt>**toJson**</dt><dd>[DEFAULT] Date formatter option using a json converter.</dd><dt>**toString**</dt><dd>Use the 'toString'-method of the date-time object to retrieve the related string representation.</dd></dl>|toJson|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'| |moshi|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
@@ -46,6 +46,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useRxJava|Whether to use the RxJava adapter with the retrofit2 library. IMPORTANT: this option has been deprecated. Please use `useRxJava3` instead.| |false|
|
||||
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: this option has been deprecated. Please use `useRxJava3` instead.| |false|
|
||||
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library.| |false|
|
||||
|useSettingsGradle|Whether the project uses settings.gradle.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'";
|
||||
public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'";
|
||||
|
||||
public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson, jackson, kotlinx_serialization}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
public static final String ROOM_MODEL_PACKAGE = "roomModelPackage";
|
||||
public static final String OMIT_GRADLE_PLUGIN_VERSIONS = "omitGradlePluginVersions";
|
||||
public static final String OMIT_GRADLE_WRAPPER = "omitGradleWrapper";
|
||||
public static final String USE_SETTINGS_GRADLE = "useSettingsGradle";
|
||||
public static final String IDEA = "idea";
|
||||
|
||||
public static final String DATE_LIBRARY = "dateLibrary";
|
||||
@@ -238,6 +239,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
cliOptions.add(CliOption.newBoolean(USE_COROUTINES, "Whether to use the Coroutines adapter with the retrofit2 library."));
|
||||
cliOptions.add(CliOption.newBoolean(OMIT_GRADLE_PLUGIN_VERSIONS, "Whether to declare Gradle plugin versions in build files."));
|
||||
cliOptions.add(CliOption.newBoolean(OMIT_GRADLE_WRAPPER, "Whether to omit Gradle wrapper for creating a sub project."));
|
||||
cliOptions.add(CliOption.newBoolean(USE_SETTINGS_GRADLE, "Whether the project uses settings.gradle."));
|
||||
cliOptions.add(CliOption.newBoolean(IDEA, "Add IntellJ Idea plugin and mark Kotlin main and test folders as source folders."));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(MOSHI_CODE_GEN, "Whether to enable codegen with the Moshi library. Refer to the [official Moshi doc](https://github.com/square/moshi#codegen) for more info."));
|
||||
|
||||
@@ -54,10 +54,12 @@ apply plugin: 'kotlinx-serialization'
|
||||
apply plugin: 'idea'
|
||||
{{/idea}}
|
||||
apply plugin: 'maven-publish'
|
||||
{{^useSettingsGradle}}
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
}
|
||||
{{/useSettingsGradle}}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
|
||||
Reference in New Issue
Block a user