Rename all properties to UpperCamelCase
Upstream dbus standard is UpperCamelCase, start matching and
check in json schema to start failing builds that don't match.
Change-Id: I2d2c6fec5a5a0b07c88c843257fa7c88d420c4e5
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index c93fb60..ab658b2 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -34,6 +34,7 @@
constexpr const char *OUTPUT_DIR = "/var/configuration/";
constexpr const char *CONFIGURATION_DIR = "/usr/share/configurations";
+constexpr const char *schemaFile = "schema.json";
constexpr const char *TEMPLATE_CHAR = "$";
constexpr const size_t PROPERTIES_CHANGED_UNTIL_FLUSH_COUNT = 20;
constexpr const int32_t MAX_MAPPER_DEPTH = 0;
@@ -69,7 +70,7 @@
{"MATCH_ONE", probe_type_codes::MATCH_ONE}}};
static constexpr std::array<const char *, 1> SETTABLE_INTERFACES = {
- "thresholds"};
+ "Thresholds"};
using BasicVariantType =
sdbusplus::message::variant<std::string, int64_t, uint64_t, double, int32_t,
@@ -767,13 +768,13 @@
}
}
- auto exposes = boardValues.find("exposes");
+ auto exposes = boardValues.find("Exposes");
if (exposes == boardValues.end())
{
continue;
}
// iterate through exposes
- jsonPointerPath += "exposes/";
+ jsonPointerPath += "Exposes/";
// store the board level pointer so we can modify it on the way down
std::string jsonPointerPathBoard = jsonPointerPath;
@@ -790,7 +791,7 @@
std::cerr << "cannot find name in field " << item << "\n";
continue;
}
- auto findStatus = item.find("status");
+ auto findStatus = item.find("Status");
// if status is not found it is assumed to be status = 'okay'
if (findStatus != item.end())
{
@@ -967,6 +968,11 @@
}
for (auto &jsonPath : jsonPaths)
{
+ if (boost::algorithm::ends_with(jsonPath.string(), schemaFile))
+ {
+ // todo: parse using schema
+ continue;
+ }
std::ifstream jsonStream(jsonPath.c_str());
if (!jsonStream.good())
{
@@ -1007,7 +1013,7 @@
{
for (auto it = _configurations.begin(); it != _configurations.end();)
{
- auto findProbe = it->find("probe");
+ auto findProbe = it->find("Probe");
auto findName = it->find("Name");
nlohmann::json probeCommand;
@@ -1071,7 +1077,7 @@
templateCharReplace(keyPair, foundDevice,
foundDeviceIdx);
}
- auto findExpose = record->find("exposes");
+ auto findExpose = record->find("Exposes");
if (findExpose == record->end())
{
continue;
@@ -1087,7 +1093,7 @@
templateCharReplace(keyPair, foundDevice,
foundDeviceIdx);
// special case bind
- if (boost::starts_with(keyPair.key(), "bind_"))
+ if (boost::starts_with(keyPair.key(), "Bind"))
{
if (keyPair.value().type() !=
nlohmann::json::value_t::string)
@@ -1099,7 +1105,7 @@
}
bool foundBind = false;
std::string bind = keyPair.key().substr(
- sizeof("bind_") - 1);
+ sizeof("Bind") - 1);
for (auto &configurationPair :
_systemConfiguration.items())
@@ -1107,7 +1113,7 @@
auto configListFind =
configurationPair.value().find(
- "exposes");
+ "Exposes");
if (configListFind ==
configurationPair.value()
@@ -1127,7 +1133,7 @@
keyPair.value()
.get<std::string>()))
{
- exposedObject["status"] =
+ exposedObject["Status"] =
"okay";
expose[bind] = exposedObject;
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index 697456d..6b12ab6 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -130,9 +130,9 @@
std::experimental::filesystem::canonical(devtreePath);
symbolPath =
symbolPath.substr(sizeof("/sys/firmware/devicetree/base") - 1);
- nlohmann::json configuration = {{"path", symbolPath},
+ nlohmann::json configuration = {{"Path", symbolPath},
{"Type", "Symbol"},
- {"bus", std::stoul(bus)},
+ {"Bus", std::stoul(bus)},
{"Name", "i2c" + bus}};
createOverlay(TEMPLATE_DIR + std::string("/Symbol.template"),
configuration);
@@ -160,7 +160,7 @@
std::string subsituteString;
// device tree symbols are in decimal
- if (keyPair.key() == "bus" &&
+ if (keyPair.key() == "Bus" &&
keyPair.value().type() == nlohmann::json::value_t::string)
{
unsigned int dec =
@@ -174,7 +174,7 @@
keyPair.value().get<std::string>(), ILLEGAL_NAME_REGEX, "_");
name = subsituteString;
}
- else if (keyPair.key() == "address")
+ else if (keyPair.key() == "Address")
{
if (keyPair.value().type() == nlohmann::json::value_t::string)
{
@@ -198,7 +198,7 @@
}
// todo: this is a lame way to fill in platform, but we only
// care about ast2500 right now
- boost::replace_all(templateStr, TEMPLATE_CHAR + std::string("platform"),
+ boost::replace_all(templateStr, TEMPLATE_CHAR + std::string("Platform"),
PLATFORM);
std::string dtsFilename =
std::string(OUTPUT_DIR) + "/" + name + "_" + type + ".dts";
@@ -269,7 +269,7 @@
for (auto entity = systemConfiguration.begin();
entity != systemConfiguration.end(); entity++)
{
- auto findExposes = entity.value().find("exposes");
+ auto findExposes = entity.value().find("Exposes");
if (findExposes == entity.value().end() ||
findExposes->type() != nlohmann::json::value_t::array)
{
@@ -278,7 +278,7 @@
for (auto &configuration : *findExposes)
{
- auto findStatus = configuration.find("status");
+ auto findStatus = configuration.find("Status");
// status missing is assumed to be 'okay'
if (findStatus != configuration.end() && *findStatus == "disabled")
{