@@ -2,7 +2,6 @@ package com.papsign.ktor.openapigen.validation
22
33import com.papsign.ktor.openapigen.*
44import com.papsign.ktor.openapigen.classLogger
5- import org.reflections.ReflectionUtils
65import kotlin.reflect.*
76import kotlin.reflect.full.*
87import kotlin.reflect.jvm.*
@@ -236,12 +235,12 @@ class ValidationHandler private constructor(
236235 transformFun = { t: Any? ->
237236 if (t != null ) {
238237 val copy = t.javaClass.kotlin.memberFunctions.find { it.name == " copy" }
239- val map = copy?.instanceParameter?.let { mutableMapOf<KParameter , Any ?>(it to t) } ? : mutableMapOf ()
238+ val copyParams = copy?.instanceParameter?.let { mutableMapOf<KParameter , Any ?>(it to t) } ? : mutableMapOf ()
240239 handled.forEach { (handler, field) ->
241240 val getter = field.kotlinProperty?.javaGetter
242241 if (copy != null && getter != null ) {
243242 val param = copy.parameters.first { it.name == field.name }
244- map [param] = handler.handle(getter(t))
243+ copyParams [param] = handler.handle(getter(t))
245244 } else {
246245 // TODO convert this to canAccess and only change status if false
247246 val accessible = field.isAccessible
@@ -250,7 +249,7 @@ class ValidationHandler private constructor(
250249 field.isAccessible = accessible
251250 }
252251 }
253- copy?.callBy(map .toMap()) ? : t
252+ copy?.callBy(copyParams .toMap()) ? : t
254253 } else t
255254 }
256255 }
0 commit comments