Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object PublishingVersions {
const val PLUGIN_VERSION = "1.4.1"
const val PLUGIN_GROUP = "com.yelp.codegen"
@Suppress("UNUSED")
const val PLUGIN_ARTIFACT = "plugin"
const val PLUGIN_VERSION = "1.4.1"
const val PLUGIN_GROUP = "com.yelp.codegen"
@Suppress("UNUSED")
const val PLUGIN_ARTIFACT = "plugin"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ import io.swagger.models.Swagger

open class KotlinCoroutineGenerator : KotlinGenerator() {

init {
templateDir = "kotlin"
}
init {
templateDir = "kotlin"
}

override fun getName() = "kotlin-coroutines"
override fun getName() = "kotlin-coroutines"

override fun wrapResponseType(imports: MutableSet<String>, responsePrimitiveType: String) = responsePrimitiveType
override fun wrapResponseType(imports: MutableSet<String>, responsePrimitiveType: String) = responsePrimitiveType

override fun getNoResponseType(imports: MutableSet<String>) = "Unit"
override fun getNoResponseType(imports: MutableSet<String>) = "Unit"

/**
* Overriding the behavior of [KotlinGenerator] to make sure operations are rendered as `suspend fun` rather
* than just plain `fun`.
*/
override fun fromOperation(
path: String?,
httpMethod: String?,
operation: Operation?,
definitions: MutableMap<String, Model>?,
swagger: Swagger?
): CodegenOperation {
val codegenOperation = super.fromOperation(path, httpMethod, operation, definitions, swagger)
codegenOperation.vendorExtensions[X_FUNCTION_QUALIFIERS] = "suspend"
return codegenOperation
}
/**
* Overriding the behavior of [KotlinGenerator] to make sure operations are rendered as `suspend fun` rather
* than just plain `fun`.
*/
override fun fromOperation(
path: String?,
httpMethod: String?,
operation: Operation?,
definitions: MutableMap<String, Model>?,
swagger: Swagger?
): CodegenOperation {
val codegenOperation = super.fromOperation(path, httpMethod, operation, definitions, swagger)
codegenOperation.vendorExtensions[X_FUNCTION_QUALIFIERS] = "suspend"
return codegenOperation
}
}
Loading