mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 04:31:08 -06:00
Make all json keys lower case
This commit is contained in:
Submodule documentation updated: da776dab64...c4e5cb78a9
@@ -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
|
||||
|
||||
@@ -139,15 +139,15 @@ nlohmann::json KeybindingManager::generateJsonJson() const {
|
||||
|
||||
for (const std::pair<const KeyWithModifier, std::string>& 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ std::string PropertyOwner::generateJson() const {
|
||||
nlohmann::json json;
|
||||
std::vector<PropertyOwner*> 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;
|
||||
}
|
||||
|
||||
@@ -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<std::string, nlohmann::json>& 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user