From 3ad2d35cb41b37c93d708df8b328509296dec8db Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Tue, 25 Apr 2023 17:40:19 -0400 Subject: [PATCH] Make all json keys lower case --- documentation | 2 +- src/engine/openspaceengine.cpp | 4 +- src/interaction/keybindingmanager.cpp | 10 ++-- src/properties/propertyowner.cpp | 12 ++--- src/scene/scenelicensewriter.cpp | 68 +++++++++++++-------------- src/scripting/scriptengine.cpp | 30 ++++++------ src/util/factorymanager.cpp | 34 +++++++------- 7 files changed, 80 insertions(+), 80 deletions(-) diff --git a/documentation b/documentation index da776dab64..c4e5cb78a9 160000 --- a/documentation +++ b/documentation @@ -1 +1 @@ -Subproject commit da776dab64b6a9eaf6b36a05e5b047b294cf7144 +Subproject commit c4e5cb78a926da417c4c0a3cbba779ffca35a447 diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 5804763566..e2b653aff7 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1056,8 +1056,8 @@ void OpenSpaceEngine::writeDocumentation() { nlohmann::json sceneProperties = settings.get(); nlohmann::json sceneGraph = scene.get(); - sceneProperties["Data"] = "Settings"; - sceneGraph["Name"] = "Scene"; + sceneProperties["data"] = "Settings"; + sceneGraph["name"] = "Scene"; nlohmann::json documentation = { sceneGraph, sceneProperties, keybindings, license, scripting, factory diff --git a/src/interaction/keybindingmanager.cpp b/src/interaction/keybindingmanager.cpp index 6018d9d351..cd1a1c4119 100644 --- a/src/interaction/keybindingmanager.cpp +++ b/src/interaction/keybindingmanager.cpp @@ -139,15 +139,15 @@ nlohmann::json KeybindingManager::generateJsonJson() const { for (const std::pair& p : _keyLua) { nlohmann::json keybind; - keybind["Name"] = ghoul::to_string(p.first); - keybind["Action"] = p.second; + keybind["name"] = ghoul::to_string(p.first); + keybind["action"] = p.second; json.push_back(std::move(keybind)); } - sortJson(json, "Name"); + sortJson(json, "name"); nlohmann::json result; - result["Name"] = "Keybindings"; - result["Keybindings"] = json; + result["name"] = "keybindings"; + result["keybindings"] = json; return result; } diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp index e743a0cd01..d7fdc84982 100644 --- a/src/properties/propertyowner.cpp +++ b/src/properties/propertyowner.cpp @@ -389,7 +389,7 @@ std::string PropertyOwner::generateJson() const { nlohmann::json json; std::vector subOwners = propertySubOwners(); for (PropertyOwner* owner : subOwners) { - json["Data"].push_back(createJson(owner)); + json["data"].push_back(createJson(owner)); } return json.dump(); @@ -403,17 +403,17 @@ nlohmann::json PropertyOwner::generateJsonJson() const { for (PropertyOwner* owner : subOwners) { if (owner->identifier() != "Scene") { nlohmann::json jsonOwner = createJson(owner); - sortJson(jsonOwner["Properties"], "Name"); - sortJson(jsonOwner["PropertyOwners"], "Name"); + sortJson(jsonOwner["properties"], "name"); + sortJson(jsonOwner["propertyOwners"], "name"); json.push_back(jsonOwner); } } - sortJson(json, "Name"); + sortJson(json, "name"); nlohmann::json result; - result["Name"] = "PropertyOwner"; - result["Data"] = json; + result["name"] = "propertyOwner"; + result["data"] = json; return result; } diff --git a/src/scene/scenelicensewriter.cpp b/src/scene/scenelicensewriter.cpp index 85ba365d45..c4bf514df0 100644 --- a/src/scene/scenelicensewriter.cpp +++ b/src/scene/scenelicensewriter.cpp @@ -57,14 +57,14 @@ nlohmann::json SceneLicenseWriter::generateJsonJson() const { if (global::profile->meta.has_value()) { metaTotal++; nlohmann::json metaJson; - metaJson["Name"] = "Profile"; - metaJson["ProfileName"] = global::profile->meta->name.value_or(""); - metaJson["Version"] = global::profile->meta->version.value_or(""); - metaJson["Description"] = global::profile->meta->description.value_or(""); - metaJson["Author"] = global::profile->meta->author.value_or(""); - metaJson["Url"] = global::profile->meta->url.value_or(""); - metaJson["License"] = global::profile->meta->license.value_or(""); - metaJson["Type"] = "license"; + metaJson["name"] = "profile"; + metaJson["profileName"] = global::profile->meta->name.value_or(""); + metaJson["version"] = global::profile->meta->version.value_or(""); + metaJson["description"] = global::profile->meta->description.value_or(""); + metaJson["author"] = global::profile->meta->author.value_or(""); + metaJson["url"] = global::profile->meta->url.value_or(""); + metaJson["license"] = global::profile->meta->license.value_or(""); + metaJson["type"] = "license"; json.push_back(std::move(metaJson)); } @@ -74,48 +74,48 @@ nlohmann::json SceneLicenseWriter::generateJsonJson() const { nlohmann::json assetJson; if (!meta.has_value()) { - assetJson["Name"] = ""; - assetJson["Version"] = ""; - assetJson["Description"] = ""; - assetJson["Author"] = ""; - assetJson["Url"] = ""; - assetJson["License"] = "No license"; - assetJson["Identifiers"] = ""; - assetJson["Path"] = asset->path().string(); + assetJson["name"] = ""; + assetJson["version"] = ""; + assetJson["description"] = ""; + assetJson["author"] = ""; + assetJson["url"] = ""; + assetJson["license"] = "No license"; + assetJson["identifiers"] = ""; + assetJson["path"] = asset->path().string(); - assetLicenses["No license"].push_back(assetJson); + assetLicenses["noLicense"].push_back(assetJson); } else { - std::string license = meta->license == "" ? "No license" : meta->license; - assetJson["Name"] = meta->name; - assetJson["Version"] = meta->version; - assetJson["Description"] = meta->description; - assetJson["Author"] = meta->author; - assetJson["Url"] = meta->url; - assetJson["License"] = license; - assetJson["Identifiers"] = meta->identifiers; - assetJson["Path"] = asset->path().string(); + std::string license = meta->license == "" ? "No License" : meta->license; + assetJson["name"] = meta->name; + assetJson["version"] = meta->version; + assetJson["description"] = meta->description; + assetJson["author"] = meta->author; + assetJson["url"] = meta->url; + assetJson["license"] = license; + assetJson["identifiers"] = meta->identifiers; + assetJson["path"] = asset->path().string(); assetLicenses[license].push_back(assetJson); } } nlohmann::json assetsJson; - assetsJson["Name"] = "Assets"; - assetsJson["Type"] = "Licenses"; + assetsJson["name"] = "assets"; + assetsJson["type"] = "licenses"; for (const std::pair& assetLicense : assetLicenses) { nlohmann::json entry; - entry["Name"] = assetLicense.first; - entry["Assets"] = assetLicense.second; - sortJson(entry["Assets"], "Name"); - assetsJson["Licenses"].push_back(entry); + entry["name"] = assetLicense.first; + entry["assets"] = assetLicense.second; + sortJson(entry["assets"], "name"); + assetsJson["licenses"].push_back(entry); } json.push_back(assetsJson); nlohmann::json result; - result["Name"] = "Licenses"; - result["Data"] = json; + result["name"] = "licenses"; + result["data"] = json; return result; } diff --git a/src/scripting/scriptengine.cpp b/src/scripting/scriptengine.cpp index ff48510f30..50954e4034 100644 --- a/src/scripting/scriptengine.cpp +++ b/src/scripting/scriptengine.cpp @@ -87,20 +87,20 @@ namespace { using namespace openspace; using namespace openspace::scripting; nlohmann::json function; - function["Name"] = f.name; + function["name"] = f.name; nlohmann::json arguments = nlohmann::json::array(); for (const LuaLibrary::Function::Argument& arg : f.arguments) { nlohmann::json argument; - argument["Name"] = arg.name; - argument["Type"] = arg.type; - argument["Default Value"] = arg.defaultValue.value_or(""); + argument["name"] = arg.name; + argument["type"] = arg.type; + argument["defaultValue"] = arg.defaultValue.value_or(""); arguments.push_back(argument); } - function["Arguments"] = arguments; - function["Return Type"] = f.returnType; - function["Help"] = f.helpText; + function["arguments"] = arguments; + function["returnType"] = f.returnType; + function["help"] = f.helpText; return function; } @@ -553,25 +553,25 @@ nlohmann::json ScriptEngine::generateJsonJson() const { using namespace openspace::scripting; nlohmann::json library; - std::string libraryName = l.name.empty() ? "openspace" : "openspace." + l.name; - library["Name"] = libraryName; + std::string libraryName = l.name; + library["name"] = libraryName; for (const LuaLibrary::Function& f : l.functions) { - library["Functions"].push_back(toJson(f)); + library["functions"].push_back(toJson(f)); } for (const LuaLibrary::Function& f : l.documentations) { - library["Functions"].push_back(toJson(f)); + library["functions"].push_back(toJson(f)); } - sortJson(library["Functions"], "Name"); + sortJson(library["functions"], "name"); json.push_back(library); - sortJson(json, "Name"); + sortJson(json, "name"); } nlohmann::json result; - result["Name"] = "Scripting API"; - result["Data"] = json; + result["name"] = "scripting"; + result["data"] = json; return result; } diff --git a/src/util/factorymanager.cpp b/src/util/factorymanager.cpp index e63905a94a..89aec6aa44 100644 --- a/src/util/factorymanager.cpp +++ b/src/util/factorymanager.cpp @@ -163,8 +163,8 @@ nlohmann::json FactoryManager::generateJsonJson() const { for (const FactoryInfo& factoryInfo : _factories) { nlohmann::json factory; - factory["Name"] = factoryInfo.name; - factory["Identifier"] = "category" + factoryInfo.name; + factory["name"] = factoryInfo.name; + factory["identifier"] = "category" + factoryInfo.name; ghoul::TemplateFactoryBase* f = factoryInfo.factory.get(); // Add documentation about base class @@ -176,15 +176,15 @@ nlohmann::json FactoryManager::generateJsonJson() const { }); if (factoryDoc != docs.end()) { nlohmann::json documentation = generateJsonDocumentation(*factoryDoc); - factory["Classes"].push_back(documentation); + factory["classes"].push_back(documentation); // Remove documentation from list check at the end if all docs got put in docs.erase(factoryDoc); } else { nlohmann::json documentation; - documentation["Name"] = factoryInfo.name; - documentation["Identifier"] = factoryInfo.name; - factory["Classes"].push_back(documentation); + documentation["name"] = factoryInfo.name; + documentation["identifier"] = factoryInfo.name; + factory["classes"].push_back(documentation); } // Add documentation about derived classes @@ -198,34 +198,34 @@ nlohmann::json FactoryManager::generateJsonJson() const { }); if (found != docs.end()) { nlohmann::json documentation = generateJsonDocumentation(*found); - factory["Classes"].push_back(documentation); + factory["classes"].push_back(documentation); docs.erase(found); } else { nlohmann::json documentation; - documentation["Name"] = c; - documentation["Identifier"] = c; - factory["Classes"].push_back(documentation); + documentation["name"] = c; + documentation["identifier"] = c; + factory["classes"].push_back(documentation); } } - sortJson(factory["Classes"], "Name"); + sortJson(factory["classes"], "name"); json.push_back(factory); } // Add all leftover docs nlohmann::json leftovers; - leftovers["Name"] = "Other"; - leftovers["Identifier"] = "other"; + leftovers["name"] = "other"; + leftovers["identifier"] = "other"; for (const Documentation& doc : docs) { - leftovers["Classes"].push_back(generateJsonDocumentation(doc)); + leftovers["classes"].push_back(generateJsonDocumentation(doc)); } - sortJson(json["Classes"]["Members"], "Name"); + sortJson(json["classes"]["members"], "name"); json.push_back(leftovers); // I did not check the output of this for correctness ---abock nlohmann::json result; - result["Name"] = "Asset Types"; - result["Data"] = json; + result["name"] = "assetTypes"; + result["data"] = json; return result; }