Functions | |
| nlohmann::json | parseJSONFile (const std::string &fileName) |
| Parse a JSON File and return it's values. More... | |
| void | jsonSchemaLoader (const json_uri &uri, json &schema) |
| Loads schema from json file given its uri. To be passed to a nlohmann::json_schema::json_validator constructor. More... | |
| void | validateJson (nlohmann::json &instance, std::string schema_path, bool addPatch=true) |
| Validates a json object using a given json schema. More... | |
| void json_utils::jsonSchemaLoader | ( | const json_uri & | uri, |
| json & | schema | ||
| ) |
Loads schema from json file given its uri. To be passed to a nlohmann::json_schema::json_validator constructor.
The function is parametrized with two parameters: uri and schema. uri provides the path to the json schema within NRP_CONFIG_INSTALL_DIR directory. the schema will be loaded into "schema" json object.
| nlohmann::json json_utils::parseJSONFile | ( | const std::string & | fileName | ) |
Parse a JSON File and return it's values.
| fileName | File Name |
| void json_utils::validateJson | ( | nlohmann::json & | instance, |
| std::string | schema_path, | ||
| bool | addPatch = true |
||
| ) |
Validates a json object using a given json schema.
Parameters: instance: json object to be validated schema_path: URI of the schema to use for validation addPatch: boolean attribute. If true, parameter default values defined in the schema are added to 'instance' after validation.