Skip to content

Commit 1593ecd

Browse files
sjoubertjreynard-code
authored andcommitted
[PROD-9005] Make sure the parameter's varType are the one from the solution
Target fix is to rework the api to remove varType from the input data instead of relying on the buggy readOnly config. In the mean time, consolidate every varType with the reference value from the solution.
1 parent 887344e commit 1593ecd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

runner/src/main/kotlin/com/cosmotech/runner/service/RunnerService.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ class RunnerService(
241241
"creationDate",
242242
"security")
243243
this.runner.compareToAndMutateIfNeeded(runner, excludedFields = excludeFields)
244+
consolidateParametersVarType()
244245

245246
// take newly added datasets and propagate existing ACL on it
246247
this.runner.datasetList
@@ -288,6 +289,7 @@ class RunnerService(
288289
val parameterValueList = this.runner.parametersValues ?: mutableListOf()
289290
parameterValueList.addAll(inheritedParameterValues)
290291
this.runner.parametersValues = parameterValueList
292+
consolidateParametersVarType()
291293

292294
// Compute rootId
293295
this.runner.parentId?.let {
@@ -301,6 +303,22 @@ class RunnerService(
301303
}
302304
}
303305

306+
fun consolidateParametersVarType() {
307+
val solutionParameters =
308+
workspace
309+
?.solution
310+
?.solutionId
311+
?.let { solutionApiService.findSolutionById(organization?.id!!, it) }
312+
?.parameters
313+
314+
this.runner.parametersValues?.forEach { runnerParam ->
315+
solutionParameters
316+
?.find { it.id == runnerParam.parameterId }
317+
?.varType
318+
?.let { runnerParam.varType = it }
319+
}
320+
}
321+
304322
fun initDatasetList(): RunnerInstance = apply {
305323
val parentId = this.runner.parentId
306324
val runnerId = this.runner.id

0 commit comments

Comments
 (0)