X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frest%2Fmodel%2FConfigMetadata.h;fp=src%2Frest%2Fmodel%2FConfigMetadata.h;h=a60bfb5b6795bb5db4ad53b11b8311250afadb81;hb=a0bada6bf7af92d281c381092e7d6881c67d905f;hp=0000000000000000000000000000000000000000;hpb=488447aed60cc52b06d71d50bee4ecf10025f7e1;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/src/rest/model/ConfigMetadata.h b/src/rest/model/ConfigMetadata.h new file mode 100644 index 0000000..a60bfb5 --- /dev/null +++ b/src/rest/model/ConfigMetadata.h @@ -0,0 +1,54 @@ +#ifndef XAPP_MODEL_ConfigMetadata_H +#define XAPP_MODEL_ConfigMetadata_H + +#include "ModelBase.h" + +namespace xapp { +namespace model { + +struct ConfigMetadata: ModelBase { + std::string ConfigType; + std::string XappName; + json validator_schema = R"( + { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigMetadata", + "properties": { + "ConfigType": { + "description": "Type of Config", + "type": "string", + "enum": ["json", "xml", "other"] + }, + "XappName": { + "description": "Name of xApp", + "type": "string" + } + }, + "required": [ + "ConfigType", + "XappName" + ], + "type": "object" + })"_json; + + virtual json get_validator_schema() const { return validator_schema; } +}; + +void from_json(const json& j, ConfigMetadata& ref) { + + std::cout << __func__ << " ConfigMetadata " << std::endl; + ref.validate_json(j); + j.at("ConfigType").get_to(ref.ConfigType); + j.at("XappName").get_to(ref.XappName); +} + +void to_json(json& j, const ConfigMetadata& ref) { + j = json { + {"ConfigType",ref.ConfigType}, + {"XappName", ref.XappName} + }; +} + +} /*namespace model*/ +} /*namespace xapp*/ +#endif /*XAPP_MODEL_ConfigMetadata_H*/