Skip to content

Commit

Permalink
Remove the default ConfigSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
mairas committed Oct 15, 2024
1 parent c7147e7 commit 67dfb39
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/sensesp/ui/config_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <map>
#include <memory>
#include <vector>
#include <cstddef>

#include "Arduino.h"
#include "ArduinoJson.h"
Expand Down Expand Up @@ -33,23 +34,20 @@ template <>
const char* get_schema_type_string(const bool dummy);

/**
* @brief Template function to provide a configuration schema for a
* ConfigItemT<T>.
* @brief Provide a configuration schema for a
* ConfigItemT<nullptr>.
*
* For this to work, an overload or a specialization of this function must
* be provided for each type T that is used in a ConfigItemT<T>.
*
* @tparam T
* @param obj
* @return const char*
*/
template <typename T>
const String ConfigSchema(const T& obj) {
inline const String ConfigSchema(const std::nullptr_t& obj) {
return "null";
}

template <typename T>
const String ConfigSchema(const std::shared_ptr<T>& obj) {
return ConfigSchema(*obj);
}

template <typename T>
bool ConfigRequiresRestart(const T& obj) {
return false;
Expand Down Expand Up @@ -271,7 +269,6 @@ class ConfigItemT : public ConfigItemBase {
String schema = ConfigSchema(*config_object_);
return schema;
}

};

/**
Expand Down

0 comments on commit 67dfb39

Please sign in to comment.