{"number", common::ParameterType::NumberType},
{"boolean", common::ParameterType::BoolType},
{"object", common::ParameterType::ObjectType},
- {"array", common::ParameterType::ArrayType}
-};
+ {"array", common::ParameterType::ArrayType}};
common::ParameterType ConvertStringToParameterType(const std::string& type) {
auto it = kTypeMap.find(type);
parameters_.emplace_back(name, type, description, is_required);
}
- // returns
- for (const auto& [name, value] : root.members("returns")) {
- common::ParameterType type = ConvertStringToParameterType(
- SafeJson::get<std::string>(*value, "type"));
- std::string description = SafeJson::get<std::string>(*value, "desc");
- // ActionParameterType -> another class???
- returns_.emplace_back(name, type, description, false);
+ try {
+ // returns
+ for (const auto& [name, value] : root.members("returns")) {
+ common::ParameterType type = ConvertStringToParameterType(
+ SafeJson::get<std::string>(*value, "type"));
+ std::string description = SafeJson::get<std::string>(*value, "desc");
+ // ActionParameterType -> another class???
+ returns_.emplace_back(name, type, description, false);
+ }
+ } catch (...) {
+ // optional
+ returns_.clear();
}
try {
"desc": "Param 2"
}
},
- "returns": {
- "return1": {
- "type": "number",
- "desc": "Return 1"
- }
- },
"requiredPrivileges": ["priv1", "priv2"],
"details": {
"pluginPath": "/path/to/plugin"
EXPECT_EQ(params[1].GetType(), ParameterType::NumberType);
const auto& returns = schema.GetReturns();
- EXPECT_EQ(returns.size(), 1);
- EXPECT_EQ(returns[0].GetType(), ParameterType::NumberType);
+ EXPECT_EQ(returns.size(), 0);
const auto& privileges = schema.GetPrivileges();
EXPECT_EQ(privileges.size(), 2);