RIC-641 Fixing client/server model definitions and adding client and server API
[ric-plt/xapp-frame-cpp.git] / src / model / ConfigMetadata.h
1 /*
2 # ==================================================================================
3 # Copyright (c) 2020 HCL Technologies Limited.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ==================================================================================
17 */
18 #ifndef XAPP_MODEL_ConfigMetadata_H
19 #define XAPP_MODEL_ConfigMetadata_H
20
21 #include "ModelBase.h"
22
23 namespace xapp {
24         namespace model {
25
26                 struct ConfigMetadata : public ModelBase {
27                         std::string ConfigType;
28                         std::string XappName;
29                         nlohmann::json validator_schema = R"(
30                                 {
31                                 "$schema": "http://json-schema.org/draft-07/schema#",
32                                 "title": "ConfigMetadata",
33                                 "properties": {
34                                     "configType": {
35                                         "description": "Type of Config",
36                                         "type": "string",
37                                         "enum": ["json", "xml", "other"]
38                                     },
39                                     "xappName": {
40                                         "description": "Name of xApp",
41                                         "type": "string"
42                                     }
43                                 },
44                                 "required": [
45                                              "ConfigType",
46                                              "XappName"
47                                              ],
48                                 "type": "object"
49                                 })"_json;
50
51                         virtual nlohmann::json get_validator_schema() const { return validator_schema; }
52                 };
53                 void from_json(const nlohmann::json& j, ConfigMetadata& ref);
54                 void to_json(nlohmann::json& j, const ConfigMetadata& ref);
55
56         } /*namespace model*/
57 } /*namespace xapp*/
58 #endif /*XAPP_MODEL_ConfigMetadata_H*/