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/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index d8c5ae3..a0dcd54 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1549,9 +1549,12 @@
std::optional<std::string> subnetMask;
std::optional<std::string> gateway;
- if (!json_util::readJsonObject(*obj, asyncResp->res, "Address",
- address, "SubnetMask", subnetMask,
- "Gateway", gateway))
+ if (!json_util::readJsonObject( //
+ *obj, asyncResp->res, //
+ "Address", address, //
+ "Gateway", gateway, //
+ "SubnetMask", subnetMask //
+ ))
{
messages::propertyValueFormatError(asyncResp->res, *obj,
pathString);
@@ -1728,9 +1731,11 @@
std::optional<std::string> address;
std::optional<uint8_t> prefixLength;
nlohmann::json::object_t thisJsonCopy = *obj;
- if (!json_util::readJsonObject(thisJsonCopy, asyncResp->res,
- "Address", address, "PrefixLength",
- prefixLength))
+ if (!json_util::readJsonObject( //
+ thisJsonCopy, asyncResp->res, //
+ "Address", address, //
+ "PrefixLength", prefixLength //
+ ))
{
messages::propertyValueFormatError(asyncResp->res, thisJsonCopy,
pathString);
@@ -2132,10 +2137,12 @@
uint32_t vlanId = 0;
std::vector<nlohmann::json::object_t> relatedInterfaces;
- if (!json_util::readJsonPatch(
- req, asyncResp->res, "VLAN/VLANEnable", vlanEnable,
- "VLAN/VLANId", vlanId, "Links/RelatedInterfaces",
- relatedInterfaces))
+ if (!json_util::readJsonPatch( //
+ req, asyncResp->res, //
+ "Links/RelatedInterfaces", relatedInterfaces, //
+ "VLAN/VLANEnable", vlanEnable, //
+ "VLAN/VLANId", vlanId //
+ ))
{
return;
}
@@ -2288,33 +2295,36 @@
std::optional<size_t> mtuSize;
DHCPParameters v4dhcpParms;
DHCPParameters v6dhcpParms;
- // clang-format off
- if (!json_util::readJsonPatch(req, asyncResp->res,
- "DHCPv4/DHCPEnabled", v4dhcpParms.dhcpv4Enabled,
- "DHCPv4/UseDNSServers", v4dhcpParms.useDnsServers,
- "DHCPv4/UseDomainName", v4dhcpParms.useDomainName,
- "DHCPv4/UseNTPServers", v4dhcpParms.useNtpServers,
- "DHCPv6/OperatingMode", v6dhcpParms.dhcpv6OperatingMode,
- "DHCPv6/UseDNSServers", v6dhcpParms.useDnsServers,
- "DHCPv6/UseDomainName", v6dhcpParms.useDomainName,
- "DHCPv6/UseNTPServers", v6dhcpParms.useNtpServers,
- "FQDN", fqdn,
- "HostName", hostname,
- "IPv4StaticAddresses", ipv4StaticAddresses,
- "IPv6DefaultGateway", ipv6DefaultGateway,
- "IPv6StaticAddresses", ipv6StaticAddresses,
- "IPv6StaticDefaultGateways", ipv6StaticDefaultGateways,
- "InterfaceEnabled", interfaceEnabled,
- "MACAddress", macAddress,
- "MTUSize", mtuSize,
- "StatelessAddressAutoConfig/IPv6AutoConfigEnabled", ipv6AutoConfigEnabled,
- "StaticNameServers", staticNameServers
- )
- )
- {
- return;
- }
- // clang-format on
+
+ if (!json_util::readJsonPatch( //
+ req, asyncResp->res, //
+ "DHCPv4/DHCPEnabled", v4dhcpParms.dhcpv4Enabled, //
+ "DHCPv4/UseDNSServers", v4dhcpParms.useDnsServers, //
+ "DHCPv4/UseDomainName", v4dhcpParms.useDomainName, //
+ "DHCPv4/UseNTPServers", v4dhcpParms.useNtpServers, //
+ "DHCPv6/OperatingMode",
+ v6dhcpParms.dhcpv6OperatingMode, //
+ "DHCPv6/UseDNSServers", v6dhcpParms.useDnsServers, //
+ "DHCPv6/UseDomainName", v6dhcpParms.useDomainName, //
+ "DHCPv6/UseNTPServers", v6dhcpParms.useNtpServers, //
+ "FQDN", fqdn, //
+ "HostName", hostname, //
+ "InterfaceEnabled", interfaceEnabled, //
+ "IPv4StaticAddresses", ipv4StaticAddresses, //
+ "IPv6DefaultGateway", ipv6DefaultGateway, //
+ "IPv6StaticAddresses", ipv6StaticAddresses, //
+ "IPv6StaticDefaultGateways",
+ ipv6StaticDefaultGateways, //
+ "InterfaceEnabled", interfaceEnabled, //
+ "MACAddress", macAddress, //
+ "MTUSize", mtuSize, //
+ "StatelessAddressAutoConfig/IPv6AutoConfigEnabled",
+ ipv6AutoConfigEnabled, //
+ "StaticNameServers", staticNameServers //
+ ))
+ {
+ return;
+ }
// Get single eth interface data, and call the below callback
// for JSON preparation