Add more types to DbusVariantType

Ideally, we'd use the DbusVariantType for all variant uses within bmcweb
to help with binary size.  This commit adds all of the missing types to
DbusVariantType in the pursuit of this goal

Adding these new types made the struct pretty unwieldy, so as part of
that port, it disables clang-format and puts each item on its own line
to help with readability.  At some point in the future, this list could
be alphabetized, but the ordering has the potential to change the
function of this, so it's avoided for the moment.

As an unrelated note, it turns out that the dbus-rest API never knew how
to serialize file descriptors.  Using a FD off the system doesn't make
much sense, but now that we have a common variant type, we're required
to provide serialization specializations, so for the moment this code
just converts it to an int.

Tested: Code compiles

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ice1953a163c761024f969acf1aa2654a8a7e9661
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 9927024..a971325 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -16,6 +16,7 @@
 #pragma once
 
 #include <sdbusplus/message.hpp>
+#include <sdbusplus/utility/dedup_variant.hpp>
 
 #include <filesystem>
 #include <regex>
@@ -26,12 +27,35 @@
 namespace utility
 {
 
-using DbusVariantType =
-    std::variant<std::vector<std::tuple<std::string, std::string, std::string>>,
-                 std::vector<std::string>, std::vector<double>, std::string,
-                 int64_t, uint64_t, double, int32_t, uint32_t, int16_t,
-                 uint16_t, uint8_t, bool>;
+// clang-format off
+using DbusVariantType = sdbusplus::utility::dedup_variant_t<
+    std::vector<std::tuple<std::string, std::string, std::string>>,
+    std::vector<std::string>,
+    std::vector<double>,
+    std::string,
+    int64_t,
+    uint64_t,
+    double,
+    int32_t,
+    uint32_t,
+    int16_t,
+    uint16_t,
+    uint8_t,
+    bool,
+    size_t,
+    sdbusplus::message::unix_fd,
+    std::vector<uint32_t>,
+    std::vector<uint16_t>,
+    sdbusplus::message::object_path,
+    std::tuple<uint64_t, std::vector<std::tuple<std::string, std::string, double, uint64_t>>>,
+    std::vector<std::tuple<std::string, std::string>>,
+    std::vector<std::tuple<uint32_t, std::vector<uint32_t>>>,
+    std::vector<std::tuple<uint32_t, size_t>>,
+    std::vector<std::tuple<sdbusplus::message::object_path, std::string,
+                           std::string, std::string>>
+ >;
 
+// clang-format on
 using DBusPropertiesMap =
     boost::container::flat_map<std::string, DbusVariantType>;
 using DBusInteracesMap =
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 3188188..78853a5 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -161,8 +161,21 @@
             for (const auto& [name, value] : propertiesList)
             {
                 nlohmann::json& propertyJson = objectJson[name];
-                std::visit([&propertyJson](auto&& val) { propertyJson = val; },
-                           value);
+                std::visit(
+                    [&propertyJson](auto&& val) {
+                        if constexpr (std::is_same_v<
+                                          std::decay_t<decltype(val)>,
+                                          sdbusplus::message::unix_fd>)
+                        {
+                            propertyJson = val.fd;
+                        }
+                        else
+                        {
+
+                            propertyJson = val;
+                        }
+                    },
+                    value);
             }
         },
         service, objectPath, "org.freedesktop.DBus.Properties", "GetAll",
@@ -262,9 +275,22 @@
                         {
                             nlohmann::json& propertyJson =
                                 objectJson[property.first];
-                            std::visit([&propertyJson](
-                                           auto&& val) { propertyJson = val; },
-                                       property.second);
+                            std::visit(
+                                [&propertyJson](auto&& val) {
+                                    if constexpr (
+                                        std::is_same_v<
+                                            std::decay_t<decltype(val)>,
+                                            sdbusplus::message::unix_fd>)
+                                    {
+                                        propertyJson = val.fd;
+                                    }
+                                    else
+                                    {
+
+                                        propertyJson = val;
+                                    }
+                                },
+                                property.second);
                         }
                     }
                 }