From d322fe3886c93eb6a2b3e9becd548e84e53ba227 Mon Sep 17 00:00:00 2001 From: Ho Kim Date: Thu, 18 May 2023 04:50:51 +0900 Subject: [PATCH] Fix a bug in dash gateway --- dash/provider/src/input.rs | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/dash/provider/src/input.rs b/dash/provider/src/input.rs index d49224a5..b9c6f32c 100644 --- a/dash/provider/src/input.rs +++ b/dash/provider/src/input.rs @@ -349,7 +349,7 @@ impl InputTemplate { }, ModelFieldKindNativeSpec::Object { children: _, - dynamic: _, + dynamic, } => match value { Value::String(ref_name) => { let input = InputFieldValue { @@ -359,12 +359,17 @@ impl InputTemplate { self.update_field_value_impl(storage, input, optional).await } Value::Object(children) => { - for (child, value) in children.into_iter() { - let child = InputField::sub_object(&name, &child, value); - self.update_field_value_impl(storage, child, optional) - .await?; + if *dynamic { + *field = Value::Object(children); + Ok(()) + } else { + for (child, value) in children.into_iter() { + let child = InputField::sub_object(&name, &child, value); + self.update_field_value_impl(storage, child, optional) + .await?; + } + Ok(()) } - Ok(()) } value => assert_optional(&name, &value, &base_field.parsed, optional), }, @@ -788,14 +793,19 @@ impl<'a> ItemTemplate<'a> { }, ModelFieldKindNativeSpec::Object { children: _, - dynamic: _, + dynamic, } => match value { Value::Object(children) => { - for (child, value) in children.into_iter() { - let child = InputField::sub_object(&name, &child, value); - self.update_field_value_impl(child, optional)?; + if *dynamic { + *field = Value::Object(children); + Ok(()) + } else { + for (child, value) in children.into_iter() { + let child = InputField::sub_object(&name, &child, value); + self.update_field_value_impl(child, optional)?; + } + Ok(()) } - Ok(()) } value => assert_optional(&name, &value, base_field, optional), },