Commit c470d6cb authored by Jason Paryani's avatar Jason Paryani

Allow DynamicEnum fields to be set with int/uint

parent 7405f5cc
......@@ -522,7 +522,11 @@ void DynamicStruct::Builder::set(StructSchema::Field field, const DynamicValue::
if (value.getType() == DynamicValue::TEXT) {
// Convert from text.
rawValue = enumSchema.getEnumerantByName(value.as<Text>()).getOrdinal();
} else {
}
else if (value.getType() == DynamicValue::INT || value.getType() == DynamicValue::UINT) {
rawValue = value.as<uint16_t>();
}
else {
DynamicEnum enumValue = value.as<DynamicEnum>();
KJ_REQUIRE(enumValue.getSchema() == enumSchema, "Value type mismatch.") {
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment