Replace maps with models to reduce casting (#11913)

This commit is contained in:
Oleh Kurpiak
2022-03-24 18:48:41 +02:00
committed by GitHub
parent eea5260208
commit 85df431ebf
137 changed files with 1037 additions and 962 deletions

View File

@@ -2,6 +2,7 @@
package com.my.company.codegen
import org.openapitools.codegen.*
import org.openapitools.codegen.model.ModelMap;
import java.util.*
import java.io.File
@@ -36,7 +37,7 @@ open class MyclientcodegenGenerator() : DefaultCodegen(), CodegenConfig {
* Provides an opportunity to inspect and modify operation data before the code is generated.
*/
@Suppress("UNCHECKED_CAST")
override fun postProcessOperationsWithModels(objs: Map<String, Any>, allModels: List<Any>?): Map<String, Any> {
override fun postProcessOperationsWithModels(objs: Map<String, Any>, allModels: List<ModelMap>?): Map<String, Any> {
val results = super.postProcessOperationsWithModels(objs, allModels)
val ops = results["operations"] as Map<String, Any>
@@ -180,4 +181,4 @@ open class MyclientcodegenGenerator() : DefaultCodegen(), CodegenConfig {
//TODO: check that this logic is safe to escape quotation mark to avoid code injection
return with(input) { replace("\"", "\\\"") }
}
}
}