Lines Matching +full:json +full:- +full:schema

4 #include "phosphor-logging/lg2.hpp"
7 #include <nlohmann/json.hpp>
9 #include <valijson/schema.hpp>
23 bool writeJsonFiles(const nlohmann::json& systemConfiguration)
36 // reads json files out of the filesystem
37 bool loadConfigurations(std::list<nlohmann::json>& configurations)
46 R"(.*\.json)", jsonPaths))
58 << "Cannot open schema file, cannot validate JSON, exiting\n\n";
62 nlohmann::json schema =
63 nlohmann::json::parse(schemaStream, nullptr, false, true);
64 if (schema.is_discarded())
67 << "Illegal schema file detected, cannot validate JSON, exiting\n";
80 auto data = nlohmann::json::parse(jsonStream, nullptr, false, true);
89 if (!validateJson(schema, data))
96 if (data.type() == nlohmann::json::value_t::array)
110 std::chrono::steady_clock::now() - start)
113 lg2::debug("Finished loading json configuration in {MILLIS}ms", "MILLIS",
120 void deriveNewConfiguration(const nlohmann::json& oldConfiguration,
121 nlohmann::json& newConfiguration)
137 // validates a given input(configuration) with a given json schema file.
138 bool validateJson(const nlohmann::json& schemaFile, const nlohmann::json& input)
140 valijson::Schema schema;
143 parser.populateSchema(schemaAdapter, schema);
146 return validator.validate(schema, targetAdapter, nullptr);
149 // Extract the D-Bus interfaces to probe from the JSON config files.
153 std::list<nlohmann::json> configurations;
161 auto findProbe = it->find("Probe");
162 if (findProbe == it->end())
169 nlohmann::json probeCommand;
170 if ((*findProbe).type() != nlohmann::json::value_t::array)
172 probeCommand = nlohmann::json::array();
180 for (const nlohmann::json& probeJson : probeCommand)
195 auto findStart = probe->find('(');
198 std::string interface = probe->substr(0, findStart);