Format readjson
clang-format may potentially reformat the readJson calls if they may
have more keys or key names are longer. This makes formatting in a way
that's readable by forcing to break a line for each key using an
empty-comment (`//`) each line.
It also allows trivially alphabetizing the list such that new additions
are less likely to have merge conflicts.
Tested:
- Check whitespace only.
- Code compiles.
- Redfish Service Validator with the same results before this
Change-Id: I3824a8c4faa9fa7c820d5d2fab6b565404926e2c
Signed-off-by: Ed Tanous <etanous@nvidia.com>
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp
index d405d26..306742a 100644
--- a/redfish-core/lib/trigger.hpp
+++ b/redfish-core/lib/trigger.hpp
@@ -280,9 +280,12 @@
std::string activation;
std::string dwellTimeStr;
- if (!json_util::readJsonObject(threshold, res, "Reading", reading,
- "Activation", activation, "DwellTime",
- dwellTimeStr))
+ if (!json_util::readJsonObject( //
+ threshold, res, //
+ "Activation", activation, //
+ "DwellTime", dwellTimeStr, //
+ "Reading", reading //
+ ))
{
return false;
}
@@ -391,9 +394,13 @@
std::string dwellTimeStr;
std::string severity;
- if (!json_util::readJsonObject(thresholdInfo, res, "Name", name,
- "Value", value, "DwellTime",
- dwellTimeStr, "Severity", severity))
+ if (!json_util::readJsonObject( //
+ thresholdInfo, res, //
+ "DwellTime", dwellTimeStr, //
+ "Name", name, //
+ "Severity", severity, //
+ "Value", value //
+ ))
{
return false;
}
@@ -595,26 +602,25 @@
std::optional<std::vector<nlohmann::json::object_t>> discreteTriggers;
std::optional<std::vector<std::string>> metricReportDefinitions;
NumericThresholds thresholds;
- // clang-format off
- if (!json_util::readJsonPatch(
- req, res,
- "Id", id,
- "Name", name,
- "MetricType", metricType,
- "TriggerActions", triggerActions,
- "DiscreteTriggerCondition", discreteTriggerCondition,
- "DiscreteTriggers", discreteTriggers,
- "NumericThresholds/UpperCritical", thresholds.upperCritical,
- "NumericThresholds/UpperWarning", thresholds.upperWarning,
- "NumericThresholds/LowerWarning", thresholds.lowerWarning,
- "NumericThresholds/LowerCritical", thresholds.lowerCritical,
- "MetricProperties", ctx.metricProperties,
- "Links/MetricReportDefinitions", metricReportDefinitions)
- )
+
+ if (!json_util::readJsonPatch( //
+ req, res, //
+ "Id", id, //
+ "DiscreteTriggerCondition", discreteTriggerCondition, //
+ "DiscreteTriggers", discreteTriggers, //
+ "Links/MetricReportDefinitions", metricReportDefinitions, //
+ "MetricProperties", ctx.metricProperties, //
+ "MetricType", metricType, //
+ "Name", name, //
+ "NumericThresholds/LowerCritical", thresholds.lowerCritical, //
+ "NumericThresholds/LowerWarning", thresholds.lowerWarning, //
+ "NumericThresholds/UpperCritical", thresholds.upperCritical, //
+ "NumericThresholds/UpperWarning", thresholds.upperWarning, //
+ "TriggerActions", triggerActions //
+ ))
{
return false;
}
- // clang-format on
ctx.id = *id;
ctx.name = *name;