1. Doxygen comments.
2. Klocwork fixes.
3 prevent issue fixes.
4. added smart pointer implemetation for JsonSchema Parser.
Change-Id: I8a6ff026fb9b03932ab7c15a19631143e0c653fa
Signed-off-by: Abitha Shankar <abitha.s@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2563
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
Tested-by: Madan Lanka <lanka.madan@samsung.com>
#******************************************************************\r
#\r
-# Copyright 2014 Samsung Electronics All Rights Reserved.\r
+# Copyright 2015 Samsung Electronics All Rights Reserved.\r
#\r
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
#\r
+#******************************************************************\r
+#\r
+# Copyright 2015 Samsung Electronics All Rights Reserved.\r
+#\r
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+#\r
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
import os\r
Import('env')\r
lib_env = env.Clone()\r
+/******************************************************************\r
+ *\r
+ * Copyright 2015 Samsung Electronics All Rights Reserved.\r
+ *\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ ******************************************************************/\r
+\r
#include "RamlParser.h"\r
#include <iostream>\r
#include <string>\r
+#include <memory>\r
\r
//#define PRINT_PARAMS\r
//#define PRINT_PROTOCOLS\r
}\r
\r
}\r
-void printProperties(Properties *prop)\r
+void printProperties(const PropertiesPtr &prop)\r
{\r
#ifdef PRINT_JSON_PROPERTIES\r
std::cout << "-------------------------------" << std::endl;\r
char *value = argv[1];\r
std::string s(value);\r
\r
- RamlParser *ramlParser = new RamlParser(s);\r
- RamlPtr m_raml = ramlParser->getRamlPtr();\r
+ try\r
+ {\r
+ std::shared_ptr<RamlParser> ramlParser = std::make_shared<RamlParser>(s);\r
+ RamlPtr m_raml = ramlParser->getRamlPtr();\r
#ifdef PRINT_RAML\r
\r
- std::cout << "#############################################" << std::endl;\r
- std::cout << "Test Raml Parser" << std::endl;\r
- std::cout << "#############################################" << std::endl;\r
+ std::cout << "#############################################" << std::endl;\r
+ std::cout << "Test Raml Parser" << std::endl;\r
+ std::cout << "#############################################" << std::endl;\r
\r
- std::cout << "Title : " << m_raml->getTitle() << std::endl;\r
- std::cout << "Version : " << m_raml->getVersion() << std::endl;\r
+ std::cout << "Title : " << m_raml->getTitle() << std::endl;\r
+ std::cout << "Version : " << m_raml->getVersion() << std::endl;\r
#ifdef PRINT_PROTOCOLS\r
- std::cout << "Protocols : " ;\r
- for (auto it : m_raml->getProtocols())\r
- {\r
- std::cout << it << " ";\r
- }\r
+ std::cout << "Protocols : " ;\r
+ for (auto it : m_raml->getProtocols())\r
+ {\r
+ std::cout << it << " ";\r
+ }\r
\r
- std::cout << std::endl;\r
+ std::cout << std::endl;\r
#endif\r
#ifdef PRINT_BASEURI\r
- std::cout << "BaseUri : " << m_raml->getBaseUri() << std::endl;\r
+ std::cout << "BaseUri : " << m_raml->getBaseUri() << std::endl;\r
\r
- std::cout << "BaseUriParameters : " << std::endl;\r
- for (auto it : m_raml->getBaseUriParameters())\r
- {\r
- std::cout << "-----------------------------" << std::endl;\r
- std::cout << it.first << " : " << std::endl;\r
- std::cout << "-----------------------------" << std::endl;\r
- UriParameter uriParameter = *it.second;\r
- printParameters((AbstractParam)uriParameter);\r
- }\r
+ std::cout << "BaseUriParameters : " << std::endl;\r
+ for (auto it : m_raml->getBaseUriParameters())\r
+ {\r
+ std::cout << "-----------------------------" << std::endl;\r
+ std::cout << it.first << " : " << std::endl;\r
+ std::cout << "-----------------------------" << std::endl;\r
+ UriParameter uriParameter = *it.second;\r
+ printParameters((AbstractParam)uriParameter);\r
+ }\r
#endif\r
#ifdef PRINT_SCHEMAS\r
- std::cout << "#############################################" << std::endl;\r
- std::cout << "Schemas" << std::endl;\r
- std::cout << "-----------------------------" << std::endl;\r
- for (auto it : m_raml->getSchemas())\r
- {\r
- std::cout << it.first << " : " << it.second->getSchema() << std::endl;\r
- }\r
+ std::cout << "#############################################" << std::endl;\r
+ std::cout << "Schemas" << std::endl;\r
+ std::cout << "-----------------------------" << std::endl;\r
+ for (auto it : m_raml->getSchemas())\r
+ {\r
+ std::cout << it.first << " : " << it.second->getSchema() << std::endl;\r
+ }\r
#endif\r
- std::cout << "MediaType : " << m_raml->getMediaType() << std::endl;\r
- std::cout << "#############################################" << std::endl;\r
+ std::cout << "MediaType : " << m_raml->getMediaType() << std::endl;\r
+ std::cout << "#############################################" << std::endl;\r
#ifdef PRINT_DOCUMENTATION\r
- std::cout << "#############################################" << std::endl;\r
+ std::cout << "#############################################" << std::endl;\r
\r
- std::cout << "Documentation" << std::endl;\r
- std::cout << "-----------------------------" << std::endl;\r
- for (auto it : m_raml->getDocumentation())\r
- {\r
- std::cout << it->getTitle() << " : " << it->getContent() << std::endl;\r
- }\r
- std::cout << "#############################################" << std::endl;\r
+ std::cout << "Documentation" << std::endl;\r
+ std::cout << "-----------------------------" << std::endl;\r
+ for (auto it : m_raml->getDocumentation())\r
+ {\r
+ std::cout << it->getTitle() << " : " << it->getContent() << std::endl;\r
+ }\r
+ std::cout << "#############################################" << std::endl;\r
#endif\r
\r
- std::cout << "Resources" << std::endl;\r
- for (auto it : m_raml->getResources())\r
- {\r
- std::cout << "-----------------------------" << std::endl;\r
- std::cout << "ResourceName :" << it.first << std::endl;\r
- printResource(it.second);\r
- }\r
+ std::cout << "Resources" << std::endl;\r
+ for (auto it : m_raml->getResources())\r
+ {\r
+ std::cout << "-----------------------------" << std::endl;\r
+ std::cout << "ResourceName :" << it.first << std::endl;\r
+ printResource(it.second);\r
+ }\r
#ifdef PRINT_TYPES\r
\r
- std::cout << "#############################################" << std::endl;\r
+ std::cout << "#############################################" << std::endl;\r
\r
- std::cout << "ResourceTypes " << std::endl;\r
- for (auto it : m_raml->getResourceTypes())\r
- {\r
- std::cout << "------------" << it.first << "-----------------" << std::endl;\r
- printResource(it.second);\r
- }\r
+ std::cout << "ResourceTypes " << std::endl;\r
+ for (auto it : m_raml->getResourceTypes())\r
+ {\r
+ std::cout << "------------" << it.first << "-----------------" << std::endl;\r
+ printResource(it.second);\r
+ }\r
#endif\r
#ifdef PRINT_TRAITS\r
\r
- std::cout << "#############################################" << std::endl;\r
+ std::cout << "#############################################" << std::endl;\r
\r
- std::cout << "Traits " << std::endl;\r
- for (auto it : m_raml->getTraits())\r
- {\r
- std::cout << "-------------" << it.first << "----------------" << std::endl;\r
- printAction(it.second);\r
- }\r
+ std::cout << "Traits " << std::endl;\r
+ for (auto it : m_raml->getTraits())\r
+ {\r
+ std::cout << "-------------" << it.first << "----------------" << std::endl;\r
+ printAction(it.second);\r
+ }\r
#endif\r
#endif\r
#ifdef PRINT_JSON\r
- for (auto it : m_raml->getResources())\r
- {\r
- for (auto tt : it.second->getActions())\r
+ for (auto it : m_raml->getResources())\r
{\r
- for (auto tu : tt.second->getResponses())\r
+ for (auto tt : it.second->getActions())\r
{\r
- for (auto tv : tu.second->getResponseBody())\r
+ for (auto tu : tt.second->getResponses())\r
{\r
- auto pro = tv.second->getSchema()->getProperties();\r
- printJsonSchema(pro);\r
- break;\r
+ for (auto tv : tu.second->getResponseBody())\r
+ {\r
+ auto pro = tv.second->getSchema()->getProperties();\r
+ printJsonSchema(pro);\r
+ break;\r
+ }\r
}\r
}\r
}\r
- }\r
#endif\r
+ }\r
+ catch (RamlException &e)\r
+ {\r
+ std::cout << e.what() << std::endl;\r
+ }\r
\r
}\r
\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file IncludeResolver.h\r
+ *\r
+ * @brief This file provides APIs for resolving included files.\r
+ */\r
+\r
#ifndef INCLUDE_RESOLVER_H\r
#define INCLUDE_RESOLVER_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class IncludeResolver\r
+ * @brief This class provides a set of APIs for resolving included files.\r
+ */\r
class IncludeResolver\r
{\r
-\r
public:\r
+ /** FileType - enumeration for Included File types*/\r
enum class FileType\r
{\r
NODE, JSON, FILE, NOTAG , ERROR\r
};\r
\r
-\r
public:\r
+ /**\r
+ * This method is for reading a file specified in YamlNode and parse it to\r
+ * getting the created RootNode from RAML file.\r
+ *\r
+ * @param yamlFile - Reference to YamlNode specifying the FileName.\r
+ *\r
+ * @return pointer to root node from the Parsed file.\r
+ */\r
YAML::Node readToYamlNode(const YAML::Node &yamlFile );\r
+\r
+ /**\r
+ * This method is for reading a file specified in YamlNode and parse the specified Json file.\r
+ *\r
+ * @param jsonFile - Reference to YamlNode specifying the FileName.\r
+ *\r
+ * @return cJSON pointer to CJson object.\r
+ */\r
cJSON *readToJson(const YAML::Node &jsonFile );\r
+\r
+ /**\r
+ * This method is for reading a file specified in YamlNode and parse the content of file.\r
+ *\r
+ * @param file - Reference to YamlNode specifying the FileName.\r
+ *\r
+ * @return contents of the file.\r
+ */\r
std::string readFromFile(const YAML::Node &file );\r
+\r
+ /**\r
+ * This method is checking the file type specified in YamlNode.\r
+ *\r
+ * @param yamlNode - Reference to YamlNode specifying the FileName.\r
+ *\r
+ * @return FileType type of file.\r
+ */\r
FileType getFileType(const YAML::Node &yamlNode );\r
+\r
+ /**\r
+ * This method is for reading a file specified and parse the content of file.\r
+ *\r
+ * @param jsonFileName - FileName of Json file to be read.\r
+ *\r
+ * @return pointer to CJson object.\r
+ */\r
cJSON *readToJson(const std::string &jsonFileName);\r
\r
+ /**\r
+ * Constructor of IncludeResolver.\r
+ */\r
IncludeResolver() {}\r
+\r
+ /**\r
+ * Constructor of IncludeResolver.\r
+ *\r
+ * @param path - configuration file path.\r
+ *\r
+ */\r
IncludeResolver(const std::string &path) : m_path(path) {}\r
+\r
private:\r
std::string m_path;\r
};\r
+\r
+ /** IncludeResolverPtr - shared Ptr to IncludeResolver.*/\r
typedef std::shared_ptr<IncludeResolver> IncludeResolverPtr;\r
\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file RamlErrorCodes.h\r
+ *\r
+ * @brief This file provides list of error codes while parsing Raml file.\r
+ */\r
+\r
#ifndef RAML_ERROR_CODES_H_\r
#define RAML_ERROR_CODES_H_\r
\r
+/** RamlParserResult - This enum provides list of error codes from RamlParser*/\r
typedef enum\r
{\r
RAML_PARSER_OK = 0,\r
-\r
RAML_FILE_PATH_REQUIRED,\r
RAML_PARSER_ERROR = 255\r
} RamlParserResult;\r
{\r
const char *RamlException::what() const noexcept\r
{\r
- if (m_mark.is_null())\r
- {\r
- return m_message.c_str();\r
- }\r
+ return m_message.c_str();\r
+ }\r
+\r
+ RamlException::RamlException(const YAML::Mark &mark, const std::string &message): m_mark(mark)\r
+ {\r
std::stringstream output;\r
output << "Error at line " << m_mark.line + 1 << ", column "\r
- << m_mark.column + 1 << ": " << m_message;\r
- return output.str().c_str();\r
+ << m_mark.column + 1 << ": " << message;\r
+ m_message = output.str();\r
}\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file RamlExceptions.h\r
+ *\r
+ * @brief This file provides exception handling while parsing RAML and Json Schema.\r
+ */\r
+\r
#ifndef RAML_EXCEPTIONS_H_\r
#define RAML_EXCEPTIONS_H_\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class RamlException\r
+ * @brief This is the base exception of all type of exception thrown from RamlParser module.\r
+ */\r
class RamlException : public std::exception\r
{\r
public:\r
+ /**\r
+ * Constructor of RamlException.\r
+ *\r
+ * @param message - String describing the error messsage.\r
+ */\r
RamlException(const std::string &message) : m_message(message) {}\r
- RamlException(const YAML::Mark &mark, const std::string &message): m_message(message),\r
- m_mark(mark) {}\r
+\r
+ /**\r
+ * Constructor of RamlException.\r
+ *\r
+ * @param mark - line and column information of exception thrown.\r
+ * @param message - String describing the error messsage.\r
+ */\r
+ RamlException(const YAML::Mark &mark, const std::string &message);\r
+\r
+ /**\r
+ * API to get error message describing exception reason.\r
+ *\r
+ * @return Null terminated string.\r
+ */\r
virtual const char *what() const noexcept;\r
virtual ~RamlException() throw() {}\r
\r
YAML::Mark m_mark;\r
};\r
\r
+ /**\r
+ * @class RamlParserException\r
+ * @brief This exception will be thrown to indicate Parser Exception.\r
+ */\r
class RamlParserException : public RamlException\r
{\r
public:\r
+ /**\r
+ * Constructor of RamlParserException.\r
+ *\r
+ * @param message - String describing the error messsage.\r
+ */\r
RamlParserException(const std::string &message): RamlException(message) {}\r
+\r
+ /**\r
+ * Constructor of RamlParserException.\r
+ *\r
+ * @param mark - line and column information of exception thrown.\r
+ * @param message - String describing the error messsage.\r
+ */\r
RamlParserException(const YAML::Mark &mark, const std::string &message): RamlException(mark,\r
message) {}\r
};\r
\r
+ /**\r
+ * @class RamlRepresentationException\r
+ * @brief This exception will be thrown to indicate invalid Raml Representation case.\r
+ */\r
class RamlRepresentationException : public RamlException\r
{\r
public:\r
+ /**\r
+ * Constructor of RamlRepresentationException.\r
+ *\r
+ * @param message - String describing the error messsage.\r
+ */\r
RamlRepresentationException(const std::string &message): RamlException(message) {}\r
+\r
+ /**\r
+ * Constructor of RamlRepresentationException.\r
+ *\r
+ * @param mark - line and column information of exception thrown.\r
+ * @param message - String describing the error messsage.\r
+ */\r
RamlRepresentationException(const YAML::Mark &mark, const std::string &message): RamlException(mark,\r
message) {}\r
};\r
\r
+ /**\r
+ * @class RamlBadFile\r
+ * @brief This exception will be thrown to indicate RAMl BadFile.\r
+ */\r
class RamlBadFile : public RamlException\r
{\r
public:\r
+ /**\r
+ * Constructor of RamlBadFile.\r
+ *\r
+ * @param message - String describing the error messsage.\r
+ */\r
RamlBadFile(const std::string &message) : RamlException(message) {}\r
+\r
+ /**\r
+ * Constructor of RamlBadFile.\r
+ *\r
+ * @param mark - line and column information of exception thrown.\r
+ * @param message - String describing the error messsage.\r
+ */\r
RamlBadFile(const YAML::Mark &mark, const std::string &message): RamlException(mark, message) {}\r
};\r
+ /**\r
+ * @class JsonException\r
+ * @brief This exception will be thrown to indicate invalid Json file.\r
+ */\r
class JsonException : public RamlException\r
{\r
public:\r
+ /**\r
+ * Constructor of JsonException.\r
+ *\r
+ * @param message - String describing the error messsage.\r
+ */\r
JsonException(const std::string &message) : RamlException(message) {}\r
\r
};\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file RamlParser.h\r
+ *\r
+ * @brief This file provides APIs for parsing Raml file.\r
+ */\r
+\r
#ifndef RAML_PARSER_H\r
#define RAML_PARSER_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class RamlParser\r
+ * @brief This class provides a set of APIs for parsing Raml file.\r
+ */\r
class RamlParser\r
{\r
private:\r
void setTraits(const std::map<std::string, RamlResourcePtr> &resource);\r
\r
public:\r
+ /**\r
+ * This method is for getting the created and Parsed RAML object from RAML file.\r
+ *\r
+ * @param result - Reference to RamlParserResult.\r
+ *\r
+ * @return pointer to Raml shared object parsed.\r
+ */\r
virtual RamlPtr getRamlPtr(RamlParserResult &result);\r
+\r
+ /**\r
+ * This method is for getting the created and Parsed RAML object from RAML file.\r
+ *\r
+ * @return pointer to Raml shared object parsed.\r
+ */\r
virtual RamlPtr getRamlPtr();\r
- RamlParser(): m_ramlPtr(std::make_shared<Raml>()), m_ramlParserResult(RAML_FILE_PATH_REQUIRED) {}\r
+\r
+ /**\r
+ * Constructor of RamlParser.\r
+ *\r
+ * NOTE: Constructor would initialize the RamlParserResult with File Path Required\r
+ */\r
+ RamlParser(): m_ramlPtr(std::make_shared<Raml>()),\r
+ m_ramlParserResult(RAML_FILE_PATH_REQUIRED) {}\r
+\r
+ /**\r
+ * Constructor of RamlParser.\r
+ *\r
+ * @param path - RAML configuration file path.\r
+ *\r
+ * NOTE: Constructor would throw RamlBadFile when invalid arguments passed, and\r
+ * RamlException if any other error occured.\r
+ */\r
RamlParser(const std::string &path): m_ramlParserResult(RAML_PARSER_ERROR)\r
{\r
if (path.length() > 0)\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file Utils.h\r
+ *\r
+ * @brief This file provides utilities for RamlParser.\r
+ */\r
\r
#ifndef UTILS_H\r
#define UTILS_H\r
{\r
namespace Keys\r
{\r
+ /** Title - Raml title key.*/\r
const std::string Title = "title";\r
+ /** Version - Raml Version key.*/\r
const std::string Version = "version";\r
+ /** BaseUri - Raml BaseUri key.*/\r
const std::string BaseUri = "baseUri";\r
+ /** Protocols - Raml Protocols key.*/\r
const std::string Protocols = "protocols";\r
+ /** MediaType - Raml MediaType key.*/\r
const std::string MediaType = "mediaType";\r
+ /** Schemas - Raml Schemas key.*/\r
const std::string Schemas = "schemas";\r
+ /** ResourceTypes - Raml ResourceTypes key.*/\r
const std::string ResourceTypes = "resourceTypes";\r
+ /** Traits - Raml Traits key.*/\r
const std::string Traits = "traits";\r
+ /** IsTrait - Raml is key.*/\r
const std::string IsTrait = "is";\r
\r
+ /** Resource - Raml Resource key.*/\r
const std::string Resource = "/";\r
- const std::vector<std::string> ActionType = {"get", "post", "put", "delete", "head", "patch", "options", "trace"};\r
+ /** ActionType - Raml allowed ActionType key.*/\r
+ const std::vector<std::string> ActionType = {"get", "post", "put", "delete",\r
+ "head", "patch", "options", "trace"\r
+ };\r
\r
+ /** Responses - Raml Responses key.*/\r
const std::string Responses = "responses";\r
+ /** Body - Raml Body key.*/\r
const std::string Body = "body";\r
+ /** Schema - Raml Schema key.*/\r
const std::string Schema = "schema";\r
+ /** Example - Raml Example key.*/\r
const std::string Example = "example";\r
\r
+ /** BaseUriParameters - Raml BaseUriParameters key.*/\r
const std::string BaseUriParameters = "baseUriParameters";\r
+ /** UriParameters - Raml UriParameters key.*/\r
const std::string UriParameters = "uriParameters";\r
+ /** Headers - Raml title Headers.*/\r
const std::string Headers = "headers";\r
+ /** QueryParameters - Raml QueryParameters key.*/\r
const std::string QueryParameters = "queryParameters";\r
+ /** FormParameters - Raml FormParameters key.*/\r
const std::string FormParameters = "formParameters";\r
+ /** DisplayName - Raml DisplayName key.*/\r
const std::string DisplayName = "displayName";\r
+ /** Description - Raml Description key.*/\r
const std::string Description = "description";\r
+ /** Type - Raml Type key.*/\r
const std::string Type = "type";\r
+ /** Enum - Raml Enum key.*/\r
const std::string Enum = "enum";\r
+ /** Pattern - Raml Pattern key.*/\r
const std::string Pattern = "pattern";\r
+ /** MinLength - Raml MinLength key.*/\r
const std::string MinLength = "minLength";\r
+ /** MaxLength - Raml MaxLength key.*/\r
const std::string MaxLength = "maxLength";\r
+ /** Minimum - Raml Minimum key.*/\r
const std::string Minimum = "minimum";\r
+ /** Maximum - Raml Maximum key.*/\r
const std::string Maximum = "maximum";\r
+ /** Repeat - Raml Repeat key.*/\r
const std::string Repeat = "repeat";\r
+ /** Required - Raml Required key.*/\r
const std::string Required = "required";\r
+ /** Default - Raml Default key.*/\r
const std::string Default = "default";\r
+ /** Title - Raml title key.*/\r
\r
+ /** Documentation - Raml Documentation key.*/\r
const std::string Documentation = "documentation";\r
+ /** Content - Raml Content key.*/\r
const std::string Content = "content";\r
\r
+ /** Json - Raml Json key.*/\r
const std::string Json = "json";\r
+ /** AllowedRamlYamlTypes - Raml AllowedRamlYamlTypes key.*/\r
const std::vector<std::string> AllowedRamlYamlTypes = {"raml", "yaml", "yml"};\r
\r
}\r
\r
+ /**\r
+ * This macro is reading yamlNode as String.\r
+ *\r
+ * @param yamlNode - reference to yamlNode\r
+ *\r
+ * @return value as string\r
+ */\r
\r
#define READ_NODE_AS_STRING(yamlNode) \\r
({ \\r
(yamlNode).as<std::string>(); \\r
})\r
\r
+ /**\r
+ * This macro is reading yamlNode as int.\r
+ *\r
+ * @param yamlNode - reference to yamlNode\r
+ *\r
+ * @return value as int\r
+ */\r
#define READ_NODE_AS_INT(yamlNode) \\r
({ \\r
(yamlNode).as<int>(); \\r
})\r
\r
+ /**\r
+ * This macro is reading yamlNode as long.\r
+ *\r
+ * @param yamlNode - reference to yamlNode\r
+ *\r
+ * @return value as long\r
+ */\r
#define READ_NODE_AS_LONG(yamlNode) \\r
({ \\r
(yamlNode).as<long>(); \\r
})\r
+ /**\r
+ * This macro is reading yamlNode as bool.\r
+ *\r
+ * @param yamlNode - reference to yamlNode\r
+ *\r
+ * @return value as bool\r
+ */\r
#define READ_NODE_AS_BOOL(yamlNode) \\r
({ \\r
(yamlNode).as<bool>(); \\r
})\r
+ /**\r
+ * This macro is getting ActionType\r
+ *\r
+ * @param key - string\r
+ *\r
+ * @return ActionType\r
+ */\r
\r
#define GET_ACTION_TYPE(key) \\r
({ \\r
- ActionType actionType; \\r
+ ActionType actionType = ActionType::GET; \\r
if (key == "get" ) \\r
- actionType = ActionType::GET; \\r
+ actionType = ActionType::GET; \\r
else if (key == "post" ) \\r
- actionType = ActionType::POST; \\r
+ actionType = ActionType::POST; \\r
else if (key == "put" ) \\r
- actionType = ActionType::PUT; \\r
+ actionType = ActionType::PUT; \\r
else if (key == "delete" ) \\r
- actionType = ActionType::DELETE; \\r
+ actionType = ActionType::DELETE; \\r
else if (key == "head" ) \\r
- actionType = ActionType::HEAD; \\r
+ actionType = ActionType::HEAD; \\r
else if (key == "patch" ) \\r
- actionType = ActionType::PATCH; \\r
+ actionType = ActionType::PATCH; \\r
else if (key == "options" ) \\r
- actionType = ActionType::OPTIONS; \\r
+ actionType = ActionType::OPTIONS; \\r
else if (key == "trace" ) \\r
- actionType = ActionType::TRACE; \\r
+ actionType = ActionType::TRACE; \\r
actionType; \\r
})\r
\r
* limitations under the License.\r
*\r
******************************************************************/\r
+\r
+/**\r
+ * @file AllowedValues.h\r
+ *\r
+ * @brief This file provides data Model for Json Schema AllowedValues.\r
+ */\r
+\r
#ifndef ALLOWED_VALUES_H_\r
#define ALLOWED_VALUES_H_\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class AllowedValues\r
+ * @brief This class provides data Model for Json Schema AllowedValues.\r
+ */\r
class AllowedValues\r
{\r
public:\r
+ /**\r
+ * This method is for setting AllowedValues\r
+ *\r
+ * @param value - Allowed Value to set.\r
+ */\r
template <typename T>\r
void addValue(const T &value)\r
{\r
m_values.push_back(temp);\r
}\r
\r
+ /**\r
+ * This method is for setting AllowedValues\r
+ *\r
+ * @param values - list of Allowed Values to set.\r
+ */\r
template <typename T>\r
void addValues(const std::vector<T> &values)\r
{\r
}\r
}\r
\r
+ /**\r
+ * This method is for getting AllowedValues\r
+ *\r
+ * @param index - Allowed Values at index to be fetched\r
+ */\r
inline ValueVariant &at(int index)\r
{\r
return m_values.at(index);\r
}\r
+\r
+ /**\r
+ * This method is for getting size of AllowedValues\r
+ *\r
+ * @return size of Allowed Values list\r
+ */\r
inline int size() const\r
{\r
return m_values.size();\r
}\r
\r
+ /**\r
+ * This method is for getting AllowedValues.\r
+ *\r
+ * @return list of AllowedValues\r
+ */\r
inline std::vector<ValueVariant> getValues()\r
{\r
return m_values;\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as integer.\r
+ *\r
+ * @return list of AllowedValues as integer.\r
+ */\r
inline std::vector<int> getValuesInt()\r
{\r
std::vector<int> values;\r
}\r
return values;\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as string.\r
+ *\r
+ * @return list of AllowedValues as string.\r
+ */\r
inline std::vector<std::string> getValuesString()\r
{\r
std::vector<std::string> values;\r
return values;\r
}\r
\r
+ /**\r
+ * This method is for getting AllowedValues as Double.\r
+ *\r
+ * @return list of AllowedValues as Double.\r
+ */\r
+ inline std::vector<double> getValuesDouble()\r
+ {\r
+ std::vector<double> values;\r
+ for (auto value : m_values)\r
+ {\r
+ values.push_back(boost::lexical_cast<double> (value));\r
+ }\r
+ return values;\r
+ }\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as Bool.\r
+ *\r
+ * @return list of AllowedValues as Bool.\r
+ */\r
+ inline std::vector<bool> getValuesBool()\r
+ {\r
+ std::vector<bool> values;\r
+ for (auto value : m_values)\r
+ {\r
+ values.push_back(boost::lexical_cast<bool> (value));\r
+ }\r
+ return values;\r
+ }\r
+\r
private:\r
std::vector<ValueVariant> m_values;\r
};\r
* limitations under the License.\r
*\r
******************************************************************/\r
+\r
+/**\r
+ * @file Definitions.h\r
+ *\r
+ * @brief This file provides data Model for Json Schema Definitions.\r
+ */\r
+\r
#ifndef DEFINITIONS_H_\r
#define DEFINITIONS_H_\r
\r
#include <vector>\r
#include <map>\r
#include "Properties.h"\r
+#include <memory>\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class Definitions\r
+ * @brief This class provides data Model for Json Schema Definitions.\r
+ */\r
class Definitions\r
{\r
public:\r
\r
+ /**\r
+ * Constructor of Definitions.\r
+ */\r
Definitions() = default;\r
+\r
+ /**\r
+ * Constructor of Definitions.\r
+ *\r
+ * @param name - Definitions name as string.\r
+ */\r
Definitions(const std::string &name) : m_defName(name) {}\r
\r
+ /**\r
+ * This method is for getting Name from Definitions.\r
+ *\r
+ * @return Definitions name as string\r
+ */\r
inline std::string getName(void) const\r
{\r
return m_defName;\r
}\r
+\r
+ /**\r
+ * This method is for setting name to Definitions\r
+ *\r
+ * @param name - Definitions name as string.\r
+ */\r
inline void setName(const std::string &name)\r
{\r
m_defName = name;\r
}\r
+\r
+ /**\r
+ * This method is for getting Type from Definitions.\r
+ *\r
+ * @return Definitions Type as string\r
+ */\r
inline std::string getType(void) const\r
{\r
return m_type;\r
}\r
+\r
+ /**\r
+ * This method is for setting Type to Definitions\r
+ *\r
+ * @param type - Definitions Type as string.\r
+ */\r
inline void setType(const std::string &type)\r
{\r
m_type = type;\r
}\r
- void addProperty(const std::string &propName, Properties *property)\r
+\r
+ /**\r
+ * This method is for getting RequiredValue from Definitions.\r
+ *\r
+ * @return list of RequiredValue as string\r
+ */\r
+ std::vector<std::string> const &getRequiredValues() const\r
{\r
- if (m_properties.end() == m_properties.find(propName))\r
- {\r
- m_properties[propName] = property;\r
- }\r
+ return m_required;\r
}\r
+\r
+ /**\r
+ * This method is for setting RequiredValue to Definitions\r
+ *\r
+ * @param reqValue - RequiredValue as string.\r
+ */\r
void setRequiredValue(const std::string &reqValue)\r
{\r
- if (m_required.end() == std::find(m_required.begin(), m_required.end(), reqValue))\r
+ auto it = m_required.begin();\r
+ for (; it != m_required.end(); ++it)\r
+ {\r
+ if (*it == reqValue)\r
+ break;\r
+ }\r
+ if (m_required.end() != it)\r
{\r
m_required.push_back(reqValue);\r
}\r
}\r
- std::vector<std::string> getRequiredValues() const\r
- {\r
- return m_required;\r
- }\r
+\r
+ /**\r
+ * This method is for getting size of Properties from Definitions.\r
+ *\r
+ * @return size of Properties map\r
+ */\r
int propertiesSize() const { return m_properties.size(); }\r
\r
- inline bool getproperty(const std::string &propName, Properties *value)\r
+ /**\r
+ * This method is for getting Properties from Definitions.\r
+ *\r
+ * @param propName - name of property as string.\r
+ *\r
+ * @return pointer to Properties.\r
+ */\r
+ inline PropertiesPtr getproperty(const std::string &propName )\r
{\r
if (m_properties.end() != m_properties.find(propName))\r
{\r
- value = m_properties[propName];\r
- return true;\r
+ return m_properties[propName];\r
}\r
- return false;\r
+ return nullptr;\r
}\r
- inline std::map<std::string, Properties *> getProperties()\r
+\r
+ /**\r
+ * This method is for getting Properties from Definitions.\r
+ *\r
+ * @return map of Property name and pointer to Properties\r
+ */\r
+ inline std::map<std::string, PropertiesPtr> const &getProperties()\r
{\r
return m_properties;\r
}\r
+\r
+ /**\r
+ * This method is for setting Properties to Definitions\r
+ *\r
+ * @param propName - Definitions Type as string.\r
+ * @param property - pointer to Properties.\r
+ */\r
+ void addProperty(const std::string &propName, const PropertiesPtr &property)\r
+ {\r
+ if (m_properties.end() == m_properties.find(propName))\r
+ {\r
+ m_properties[propName] = property;\r
+ }\r
+ }\r
private:\r
- std::map<std::string, Properties *> m_properties;\r
+ std::map<std::string, PropertiesPtr > m_properties;\r
std::string m_defName;\r
std::string m_type;\r
std::vector<std::string> m_required;\r
\r
};\r
+\r
+ /** DefinitionsPtr - shared Ptr to Definitions.*/\r
typedef std::shared_ptr<Definitions> DefinitionsPtr;\r
\r
}\r
* limitations under the License.\r
*\r
******************************************************************/\r
+\r
+/**\r
+ * @file Helpers.h\r
+ *\r
+ * @brief This file provides helper definitions for Json Schema parser.\r
+ */\r
+\r
#ifndef HELPERS_H_\r
#define HELPERS_H_\r
\r
namespace RAML\r
{\r
\r
-\r
+ /** ValueVariant - Boost Variant to hold type of int, string, double and bool*/\r
typedef boost::variant <\r
int,\r
double,\r
std::string\r
> ValueVariant;\r
\r
+ /** VariantType - enumeration for variant types*/\r
+ enum class VariantType\r
+ {\r
+ INT, DOUBLE, BOOL, STRING\r
+ };\r
+\r
+\r
}\r
#endif\r
* limitations under the License.\r
*\r
******************************************************************/\r
+\r
+/**\r
+ * @file Items.h\r
+ *\r
+ * @brief This file provides data Model for Json Schema Array Items.\r
+ */\r
+\r
#ifndef ITEMS_H_\r
#define ITEMS_H_\r
\r
#include "Properties.h"\r
#include "Helpers.h"\r
#include "AllowedValues.h"\r
+#include <memory>\r
\r
namespace RAML\r
{\r
class Properties;\r
class AllowedValues;\r
+ /**\r
+ * @class Items\r
+ * @brief This class provides data Model for Json Schema Array Items.\r
+ */\r
class Items\r
{\r
public:\r
+ /**\r
+ * Constructor of Items.\r
+ */\r
Items() {}\r
- void addProperty(const std::string &propName, Properties *property)\r
+\r
+ /**\r
+ * This method is for setting Properties to Items\r
+ *\r
+ * @param propName - Properties name as string.\r
+ * @param property - pointer to Properties.\r
+ */\r
+ void addProperty(const std::string &propName, const std::shared_ptr<Properties> &property)\r
{\r
if (m_properties.end() == m_properties.find(propName))\r
{\r
m_properties[propName] = property;\r
}\r
}\r
- bool getproperty(const std::string &propName, Properties *value)\r
+\r
+ /**\r
+ * This method is for getting Properties from Items.\r
+ *\r
+ * @param propName - Properties name as string.\r
+ *\r
+ * @return pointer to Properties to put the value got\r
+ */\r
+ std::shared_ptr<Properties> getproperty(const std::string &propName)\r
{\r
if (m_properties.end() != m_properties.find(propName))\r
{\r
- value = m_properties[propName];\r
- return true;\r
+ return m_properties[propName];\r
}\r
- return false;\r
+ return nullptr;\r
}\r
- std::map<std::string, Properties *> getProperties()\r
+\r
+ /**\r
+ * This method is for getting Properties from Items.\r
+ *\r
+ * @return map of Properties name as string and pointer to Properties\r
+ */\r
+ std::map<std::string, std::shared_ptr<Properties> > const &getProperties()\r
{\r
return m_properties;\r
}\r
+\r
+ /**\r
+ * This method is for setting Type to Items\r
+ *\r
+ * @param type - Type as string.\r
+ */\r
void setType(const std::string &type)\r
{\r
m_type = type;\r
}\r
+\r
+ /**\r
+ * This method is for getting Type from Items.\r
+ *\r
+ * @return Type as string\r
+ */\r
std::string getType()\r
{\r
return m_type;\r
}\r
+\r
+ /**\r
+ * This method is for setting RequiredValue to Items\r
+ *\r
+ * @param reqValue - RequiredValue as string.\r
+ */\r
void setRequiredValue(const std::string &reqValue)\r
{\r
- if (m_required.end() == std::find(m_required.begin(), m_required.end(), reqValue))\r
+ auto it = m_required.begin();\r
+ for (; it != m_required.end(); ++it)\r
+ {\r
+ if (*it == reqValue)\r
+ break;\r
+ }\r
+ if (m_required.end() != it)\r
{\r
m_required.push_back(reqValue);\r
}\r
}\r
- std::vector<std::string> getRequiredValues()\r
+\r
+ /**\r
+ * This method is for getting RequiredValue from Items.\r
+ *\r
+ * @return list of RequiredValue as string\r
+ */\r
+ std::vector<std::string> const &getRequiredValues()\r
{\r
return m_required;\r
}\r
+\r
+ /**\r
+ * This method is for setting AllowedValues to Items\r
+ *\r
+ * @param values -list of AllowedValues.\r
+ */\r
template <typename T>\r
bool setAllowedValues(const std::vector<T> &values)\r
{\r
m_allowedValues.addValues(values);\r
return true;\r
}\r
+\r
+ /**\r
+ * This method is for getting size of AllowedValues from Items.\r
+ *\r
+ * @return size of AllowedValues\r
+ */\r
inline int getAllowedValuesSize() const\r
{\r
return m_allowedValues.size();\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues from Items.\r
+ *\r
+ * @return list of AllowedValues\r
+ */\r
inline std::vector<ValueVariant> getAllowedValues()\r
{\r
return m_allowedValues.getValues();\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as Integer from Items.\r
+ *\r
+ * @return list of AllowedValues as Integer\r
+ */\r
inline std::vector<int> getAllowedValuesInt()\r
{\r
return m_allowedValues.getValuesInt();\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as String from Items.\r
+ *\r
+ * @return list of AllowedValues as String\r
+ */\r
inline std::vector<std::string> getAllowedValuesString()\r
{\r
return m_allowedValues.getValuesString();\r
}\r
private:\r
- std::map<std::string, Properties *> m_properties;\r
+ std::map<std::string, std::shared_ptr<Properties> > m_properties;\r
std::string m_type;\r
std::vector<std::string> m_required;\r
AllowedValues m_allowedValues;\r
};\r
+\r
+ /** ItemsPtr - shared Ptr to Items.*/\r
+ typedef std::shared_ptr<Items> ItemsPtr;\r
}\r
#endif\r
\r
do\r
{\r
cJSON *item = cJSON_GetArrayItem(jsonItems, item_index);\r
- Items *newItem = readItems(item);\r
- setItem(newItem);\r
+ setItem(readItems(item));\r
}\r
while ( ++item_index < item_size);\r
}\r
else\r
{\r
- Items *newItem = readItems(jsonItems);\r
- setItem(newItem);\r
+ setItem(readItems(jsonItems));\r
}\r
}\r
}\r
}\r
}\r
\r
- Definitions *JsonSchema::readDef(cJSON *childDefinitions, const std::string &defName)\r
+ DefinitionsPtr JsonSchema::readDef(cJSON *childDefinitions, const std::string &defName)\r
{\r
- Definitions *definition = new Definitions(defName);\r
+ DefinitionsPtr definition = std::make_shared<Definitions>(defName);\r
\r
cJSON *defType = cJSON_GetObjectItem(childDefinitions, "type");\r
if (defType)\r
return definition;\r
}\r
\r
- Properties *JsonSchema::readProp(cJSON *childProperties, const std::string &attName )\r
+ PropertiesPtr JsonSchema::readProp(cJSON *childProperties, const std::string &attName )\r
{\r
- Properties *property = new Properties(attName);\r
+ PropertiesPtr property = std::make_shared<Properties>(attName);\r
\r
cJSON *propertyUpdateFrequency = cJSON_GetObjectItem(childProperties, "update_frequency");\r
if (propertyUpdateFrequency)\r
return property;\r
}\r
\r
- void JsonSchema::readValues(cJSON *childProperties, Properties *property ,\r
+ void JsonSchema::readValues(cJSON *childProperties, PropertiesPtr property ,\r
const std::string &attType)\r
{\r
if (attType == "string")\r
}\r
}\r
\r
- void JsonSchema::readString(cJSON *childProperties, Properties *property)\r
+ void JsonSchema::readString(cJSON *childProperties, PropertiesPtr property)\r
{\r
cJSON *stringMax = cJSON_GetObjectItem(childProperties, "maxLength");\r
if (stringMax)\r
}\r
}\r
\r
- void JsonSchema::readArray(cJSON *childProperties, Properties *property)\r
+ void JsonSchema::readArray(cJSON *childProperties, PropertiesPtr property)\r
{\r
cJSON *itemValues = cJSON_GetObjectItem(childProperties, "items");\r
if (itemValues)\r
do\r
{\r
cJSON *item = cJSON_GetArrayItem(itemValues, item_index);\r
- Items *newItem = readItems(item);\r
- property->setItem(newItem);\r
+ property->setItem(readItems(item));\r
}\r
while ( ++item_index < item_size);\r
}\r
else\r
{\r
- Items *newItem = readItems(itemValues);\r
- property->setItem(newItem);\r
+ property->setItem(readItems(itemValues));\r
}\r
}\r
cJSON *itemsMax = cJSON_GetObjectItem(childProperties, "maxItems");\r
}\r
}\r
\r
- void JsonSchema::readNumber(cJSON *childProperties, Properties *property)\r
+ void JsonSchema::readNumber(cJSON *childProperties, PropertiesPtr property)\r
{\r
cJSON *Max = cJSON_GetObjectItem(childProperties, "maximum");\r
if (Max)\r
}\r
\r
}\r
- Definitions *JsonSchema::readRef(std::string m_ref)\r
+ DefinitionsPtr JsonSchema::readRef(std::string m_ref)\r
{\r
std::string delimiter1 = "#";\r
std::string delimiter2 = "/";\r
if (!(defName.empty()))\r
{\r
cJSON *m_json = m_includeResolver->readToJson(fileName);\r
- JsonSchema *Refparser = new JsonSchema(m_json, m_includeResolver);\r
- Definitions *definition = Refparser->getDefinition(defName);\r
+ JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(m_json, m_includeResolver);\r
+ DefinitionsPtr definition = Refparser->getDefinition(defName);\r
if (definition == nullptr)\r
throw JsonException("Definition Name Incorrect");\r
return definition;\r
}\r
}\r
}\r
+ throw JsonException("Definition Name Empty");\r
+ return nullptr;\r
}\r
void JsonSchema::readAllOf(cJSON *allofValues)\r
{\r
void JsonSchema::readJsonRef(cJSON *jsonReference)\r
{\r
std::string m_ref = jsonReference->valuestring;\r
- std::map<std::string, Properties *> properties;\r
+ std::map<std::string, PropertiesPtr > properties;\r
std::vector<std::string> required;\r
\r
std::string web = "http://";\r
{\r
std::string fileName = m_ref.substr(0, pos);\r
cJSON *m_json = m_includeResolver->readToJson(fileName);\r
- JsonSchema *Refparser = new JsonSchema(m_json, m_includeResolver);\r
+ JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(m_json, m_includeResolver);\r
\r
properties = Refparser->getProperties();\r
required = Refparser->getRequiredValues();\r
}\r
else\r
{\r
- Definitions *definition = readRef(m_ref);\r
+ DefinitionsPtr definition = readRef(m_ref);\r
properties = definition->getProperties();\r
required = definition->getRequiredValues();\r
}\r
\r
}\r
}\r
- void JsonSchema::readDefAllOf(cJSON *allofValues, Definitions *definition)\r
+ void JsonSchema::readDefAllOf(cJSON *allofValues, DefinitionsPtr definition)\r
{\r
int size = cJSON_GetArraySize(allofValues);\r
int index = 0;\r
}\r
while ( ++index < size);\r
}\r
- void JsonSchema::readDefRef(cJSON *defReference, Definitions *definition)\r
+ void JsonSchema::readDefRef(cJSON *defReference, DefinitionsPtr definition)\r
{\r
std::string m_ref = defReference->valuestring;\r
- std::map<std::string, Properties *> properties;\r
+ std::map<std::string, PropertiesPtr > properties;\r
std::vector<std::string> required;\r
std::string type;\r
\r
{\r
std::string fileName = m_ref.substr(0, pos);\r
cJSON *m_json = m_includeResolver->readToJson(fileName);\r
- JsonSchema *Refparser = new JsonSchema(m_json, m_includeResolver);\r
+ JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(m_json, m_includeResolver);\r
\r
properties = Refparser->getProperties();\r
required = Refparser->getRequiredValues();\r
}\r
else\r
{\r
- Definitions *definitionRef = readRef(m_ref);\r
+ DefinitionsPtr definitionRef = readRef(m_ref);\r
properties = definitionRef->getProperties();\r
required = definitionRef->getRequiredValues();\r
type = definitionRef->getType();\r
definition->setType(type);\r
}\r
}\r
- Items *JsonSchema::readItems(cJSON *item)\r
+ ItemsPtr JsonSchema::readItems(cJSON *item)\r
{\r
- Items *newItem = new Items();\r
+ ItemsPtr newItem = std::make_shared<Items>();\r
cJSON *itemType = cJSON_GetObjectItem(item, "type");\r
if (itemType)\r
{\r
while (childProperties)\r
{\r
std::string attName = childProperties->string;\r
- Properties *property = readProp(childProperties, attName);\r
\r
- newItem->addProperty(attName, property);\r
+ newItem->addProperty(attName, readProp(childProperties, attName));\r
childProperties = childProperties->next;\r
}\r
}\r
{\r
readItemAllOf(itemAllOf , newItem);\r
}\r
- return (newItem);\r
+ return newItem;\r
}\r
\r
- void JsonSchema::readItemRef(cJSON *itemReference, Items *item)\r
+ void JsonSchema::readItemRef(cJSON *itemReference, ItemsPtr item)\r
{\r
std::string m_ref = itemReference->valuestring;\r
- std::map<std::string, Properties *> properties;\r
+ std::map<std::string, PropertiesPtr > properties;\r
std::vector<std::string> required;\r
std::string type;\r
\r
{\r
std::string fileName = m_ref.substr(0, pos);\r
cJSON *m_json = m_includeResolver->readToJson(fileName);\r
- JsonSchema *Refparser = new JsonSchema(m_json, m_includeResolver);\r
+ JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(m_json, m_includeResolver);\r
\r
properties = Refparser->getProperties();\r
required = Refparser->getRequiredValues();\r
}\r
else\r
{\r
- Definitions *definitionRef = readRef(m_ref);\r
+ DefinitionsPtr definitionRef = readRef(m_ref);\r
properties = definitionRef->getProperties();\r
required = definitionRef->getRequiredValues();\r
type = definitionRef->getType();\r
}\r
}\r
\r
- void JsonSchema::readItemAllOf(cJSON *allofValues, Items *item)\r
+ void JsonSchema::readItemAllOf(cJSON *allofValues, ItemsPtr item)\r
{\r
int size = cJSON_GetArraySize(allofValues);\r
int index = 0;\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file JsonSchema.h\r
+ *\r
+ * @brief This file provides data Model for Json Schema file.\r
+ */\r
+\r
#ifndef JSON_SCHEMA_H_\r
#define JSON_SCHEMA_H_\r
\r
#include "cJSON.h"\r
#include "Helpers.h"\r
#include "AllowedValues.h"\r
+#include <memory>\r
\r
#include "IncludeResolver.h"\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class JsonSchema\r
+ * @brief This class provides data Model for Json Schema file.\r
+ */\r
class JsonSchema\r
{\r
public:\r
+ /**\r
+ * Constructor of JsonSchema.\r
+ */\r
JsonSchema() : m_cjson(NULL), m_includeResolver(NULL) {}\r
+\r
+ /**\r
+ * Constructor of JsonSchema.\r
+ *\r
+ * @param includeResolver - Reference to IncludeResolver for reading external files\r
+ */\r
JsonSchema(const IncludeResolverPtr &includeResolver) : m_cjson(NULL),\r
m_includeResolver(includeResolver) {}\r
+\r
+ /**\r
+ * Constructor of JsonSchema.\r
+ *\r
+ * @param cjson - pointer to cjson\r
+ * @param includeResolver - Reference to IncludeResolver for reading external files\r
+ */\r
JsonSchema(cJSON *cjson , const IncludeResolverPtr &includeResolver) : m_cjson(cjson),\r
m_includeResolver(includeResolver) { readJson(); }\r
\r
+\r
+ /**\r
+ * This method is for setting cJson pointer to JsonSchema.\r
+ *\r
+ * @param cjson -pointer to cJson\r
+ */\r
void setcJson(cJSON *cjson) {m_cjson = cjson; readJson(); }\r
+\r
+ /**\r
+ * This method is for getting size of Properties from JsonSchema.\r
+ *\r
+ * @return size of Properties\r
+ */\r
int size() const\r
{\r
return m_properties.size();\r
}\r
- inline bool getProperty(const std::string &name, Properties *value)\r
+\r
+ /**\r
+ * This method is for getting Properties from JsonSchema.\r
+ *\r
+ * @param name -name of property as string\r
+ *\r
+ * @return pointer to Properties\r
+ */\r
+ inline PropertiesPtr getProperty(const std::string &name)\r
{\r
if (m_properties.end() != m_properties.find(name))\r
{\r
- value = m_properties[name];\r
- return true;\r
+ return m_properties[name];\r
}\r
- return false;\r
+ return nullptr;\r
}\r
- inline std::map<std::string, Properties *> getProperties()\r
+\r
+ /**\r
+ * This method is for getting Properties from JsonSchema.\r
+ *\r
+ * @return map of Properties name and pointer to Properties\r
+ */\r
+ inline std::map<std::string, PropertiesPtr > const &getProperties()\r
{\r
return m_properties;\r
}\r
- inline std::map<std::string, Definitions *> getDefinitions()\r
+\r
+ /**\r
+ * This method is for getting Definitions from JsonSchema.\r
+ *\r
+ * @return map of Definitions name and pointer to Definitions\r
+ */\r
+ inline std::map<std::string, DefinitionsPtr > const &getDefinitions()\r
{\r
return m_definition;\r
}\r
- void addProperty(const std::string &name, Properties *property)\r
+\r
+ /**\r
+ * This method is for setting Properties to JsonSchema.\r
+ *\r
+ * @param name -name of property as string\r
+ * @param property -pointer to Properties\r
+ */\r
+ void addProperty(const std::string &name, const PropertiesPtr &property)\r
{\r
if (m_properties.end() == m_properties.find(name))\r
{\r
m_properties[name] = property;\r
}\r
}\r
+\r
+ /**\r
+ * This method is for setting RequiredValue to JsonSchema.\r
+ *\r
+ * @param reqValue -name of RequiredValue as string\r
+ */\r
void setRequiredValue(const std::string &reqValue)\r
{\r
if (m_required.end() == std::find(m_required.begin(), m_required.end(), reqValue))\r
m_required.push_back(reqValue);\r
}\r
}\r
- std::vector<std::string> getRequiredValues()\r
+\r
+ /**\r
+ * This method is for getting RequiredValues from JsonSchema.\r
+ *\r
+ * @return vector of RequiredValues as string\r
+ */\r
+ std::vector<std::string> const &getRequiredValues()\r
{\r
return m_required;\r
}\r
- void addDefinition(const std::string &defName, Definitions *definition)\r
+\r
+ /**\r
+ * This method is for setting Definitions to JsonSchema.\r
+ *\r
+ * @param defName -name of Definitions as string\r
+ * @param definition -pointer to Definitions\r
+ */\r
+ void addDefinition(const std::string &defName, const DefinitionsPtr &definition)\r
{\r
if (m_definition.end() == m_definition.find(defName))\r
{\r
m_definition[defName] = definition;\r
}\r
}\r
- Definitions *getDefinition(const std::string &defName)\r
+\r
+ /**\r
+ * This method is for getting Definitions from JsonSchema.\r
+ *\r
+ * @param defName -Definition name as string\r
+ *\r
+ * @return pointer to Definitions\r
+ */\r
+ DefinitionsPtr getDefinition(const std::string &defName)\r
{\r
if (m_definition.end() != m_definition.find(defName))\r
{\r
}\r
return nullptr;\r
}\r
+\r
+ /**\r
+ * This method is for getting Type from JsonSchema.\r
+ *\r
+ * @return JsonSchema Type as string\r
+ */\r
std::string getType()\r
{\r
return m_type;\r
}\r
+\r
+ /**\r
+ * This method is for getting Id from JsonSchema.\r
+ *\r
+ * @return JsonSchema Id as string\r
+ */\r
std::string getId()\r
{\r
return m_id;\r
}\r
+\r
+ /**\r
+ * This method is for getting Schema from JsonSchema.\r
+ *\r
+ * @return Schema as string\r
+ */\r
std::string getSchema()\r
{\r
return m_schema;\r
}\r
+\r
+ /**\r
+ * This method is for getting Description from JsonSchema.\r
+ *\r
+ * @return JsonSchema Description as string\r
+ */\r
std::string getDescription()\r
{\r
return m_description;\r
}\r
+\r
+ /**\r
+ * This method is for getting Title from JsonSchema.\r
+ *\r
+ * @return JsonSchema Title as string\r
+ */\r
std::string getTitle()\r
{\r
return m_title;\r
}\r
\r
+ /**\r
+ * This method is for getting AdditionalProperties from JsonSchema.\r
+ *\r
+ * @return AdditionalProperties as bool\r
+ */\r
bool getAdditionalProperties()\r
{\r
return m_additionalProperties;\r
}\r
- void setItem(Items *item)\r
+\r
+ /**\r
+ * This method is for setting Items to JsonSchema.\r
+ *\r
+ * @param item -pointer to Items\r
+ */\r
+ void setItem(const ItemsPtr &item)\r
{\r
m_items.push_back(item);\r
}\r
- std::vector<Items *> getItems()\r
+\r
+ /**\r
+ * This method is for getting Items from JsonSchema.\r
+ *\r
+ * @return vector of Items\r
+ */\r
+ std::vector<ItemsPtr> const &getItems()\r
{\r
return m_items;\r
}\r
\r
+ private:\r
void readJson();\r
- Definitions *readDef(cJSON *childDefinitions, const std::string &defName);\r
- Properties *readProp(cJSON *childProperties, const std::string &attName );\r
- void readValues( cJSON *childProperties, Properties *property , const std::string &attType);\r
- void readString( cJSON *childProperties, Properties *property);\r
- void readArray( cJSON *childProperties, Properties *property);\r
- void readNumber( cJSON *childProperties, Properties *property);\r
- Definitions *readRef(std::string m_ref);\r
+ DefinitionsPtr readDef(cJSON *childDefinitions, const std::string &defName);\r
+ PropertiesPtr readProp(cJSON *childProperties, const std::string &attName );\r
+ void readValues( cJSON *childProperties, PropertiesPtr property ,\r
+ const std::string &attType);\r
+ void readString( cJSON *childProperties, PropertiesPtr property);\r
+ void readArray( cJSON *childProperties, PropertiesPtr property);\r
+ void readNumber( cJSON *childProperties, PropertiesPtr property);\r
+ DefinitionsPtr readRef(std::string m_ref);\r
\r
\r
void readJsonRef(cJSON *jsonReference);\r
- void readDefRef(cJSON *defReference, Definitions *definition);\r
+ void readDefRef(cJSON *defReference, DefinitionsPtr definition);\r
void readAllOf(cJSON *allofValues);\r
- void readDefAllOf(cJSON *allofValues, Definitions *definition);\r
- Items *readItems(cJSON *item);\r
- void readItemRef(cJSON *itemReference, Items *item);\r
- void readItemAllOf(cJSON *allofValues, Items *item);\r
+ void readDefAllOf(cJSON *allofValues, DefinitionsPtr definition);\r
+ ItemsPtr readItems(cJSON *item);\r
+ void readItemRef(cJSON *itemReference, ItemsPtr item);\r
+ void readItemAllOf(cJSON *allofValues, ItemsPtr item);\r
\r
private:\r
- std::map<std::string, Properties *> m_properties;\r
- std::map<std::string, Definitions *> m_definition;\r
+ std::map<std::string, PropertiesPtr > m_properties;\r
+ std::map<std::string, DefinitionsPtr > m_definition;\r
std::string m_id;\r
std::string m_schema;\r
std::string m_title;\r
std::string m_type;\r
cJSON *m_cjson;\r
std::vector<std::string> m_required;\r
- std::vector<Items *> m_items;\r
+ std::vector<ItemsPtr > m_items;\r
IncludeResolverPtr m_includeResolver;\r
};\r
+\r
+ /** JsonSchemaPtr - shared Ptr to JsonSchema.*/\r
typedef std::shared_ptr<JsonSchema> JsonSchemaPtr;\r
\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file Properties.h\r
+ *\r
+ * @brief This file provides data Model for Json Schema Properties.\r
+ */\r
+\r
#ifndef PROPERTIES_H_\r
#define PROPERTIES_H_\r
\r
#include "Items.h"\r
#include "AllowedValues.h"\r
#include "cJSON.h"\r
+#include <memory>\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class Properties\r
+ * @brief This class provides data Model for Json Schema Properties.\r
+ */\r
class Properties\r
{\r
public:\r
- Properties(): m_min(INT_MAX), m_max(INT_MAX), m_multipleOf(INT_MAX) {}\r
+ /**\r
+ * Constructor of Properties.\r
+ */\r
+ Properties(): m_min(INT_MAX), m_max(INT_MAX), m_multipleOf(INT_MAX), m_updateInterval(0),\r
+ m_unique(false), m_additionalItems(false) {}\r
+\r
+ /**\r
+ * Constructor of Properties.\r
+ *\r
+ * @param name - Properties name as string.\r
+ */\r
Properties(const std::string &name) : m_name(name), m_min(INT_MAX), m_max(INT_MAX),\r
- m_multipleOf(INT_MAX) {}\r
+ m_multipleOf(INT_MAX), m_updateInterval(0), m_unique(false), m_additionalItems(false) {}\r
\r
+ /**\r
+ * This method is for getting Name from Properties.\r
+ *\r
+ * @return Properties name as string\r
+ */\r
inline std::string getName(void) const\r
{\r
return m_name;\r
}\r
+\r
+ /**\r
+ * This method is for setting name to Properties\r
+ *\r
+ * @param name - Properties name as string.\r
+ */\r
inline void setName(const std::string &name)\r
{\r
m_name = name;\r
}\r
+\r
+ /**\r
+ * This method is for getting Value from Properties.\r
+ *\r
+ * @return Properties Value\r
+ */\r
template <typename T>\r
T getValue() const\r
{\r
- T val = T();\r
return boost::get<T>(m_value);\r
}\r
\r
+ /**\r
+ * This method is for getting Value from Properties.\r
+ *\r
+ * @return Properties Value\r
+ */\r
ValueVariant &getValue()\r
{\r
return m_value;\r
}\r
\r
+ /**\r
+ * This method is for getting ValueVariant type from Properties.\r
+ *\r
+ * @return Properties Value type as Int\r
+ */\r
int getValueType() const\r
{\r
return m_value.which();\r
}\r
+\r
+ /**\r
+ * This method is for getting ValueVariant type from Properties.\r
+ *\r
+ * @return Properties VariantType type\r
+ */\r
+ VariantType getVariantType() const\r
+ {\r
+ if (m_value.which() == 3)\r
+ return VariantType::STRING;\r
+ else if (m_value.which() == 2)\r
+ return VariantType::BOOL;\r
+ else if (m_value.which() == 1)\r
+ return VariantType::DOUBLE;\r
+ else\r
+ return VariantType::INT;\r
+ }\r
+\r
+ /**\r
+ * This method is for getting Value type as Integer from Properties.\r
+ *\r
+ * @return Properties Value type as Integer\r
+ */\r
int getValueInt()\r
{\r
return boost::lexical_cast<int> (m_value);\r
}\r
+\r
+ /**\r
+ * This method is for getting Value type as String from Properties.\r
+ *\r
+ * @return Properties Value type as String\r
+ */\r
std::string getValueString()\r
{\r
return boost::lexical_cast<std::string> (m_value);\r
}\r
\r
+ /**\r
+ * This method is for getting Value type as double from Properties.\r
+ *\r
+ * @return Properties Value type as double\r
+ */\r
+ double getValueDouble()\r
+ {\r
+ return boost::lexical_cast<double> (m_value);\r
+ }\r
+\r
+ /**\r
+ * This method is for getting Value type as bool from Properties.\r
+ *\r
+ * @return Properties Value type as bool\r
+ */\r
+ bool getValueBool()\r
+ {\r
+ return boost::lexical_cast<bool> (m_value);\r
+ }\r
+\r
+ /**\r
+ * This method is for setting Value to Properties\r
+ *\r
+ * @param value - Properties Value.\r
+ */\r
template <typename T>\r
void setValue(const T &value)\r
{\r
m_value = value;\r
}\r
+\r
+ /**\r
+ * This method is for getting Range from Properties.\r
+ *\r
+ * @param min - reference to hold Minimum value of Properties.\r
+ * @param max - reference to hold Maximum value of Properties.\r
+ * @param multipleOf - reference to hold multipleOf value of Properties.\r
+ */\r
inline void getRange(int &min, int &max, int &multipleOf) const\r
{\r
min = m_min;\r
max = m_max;\r
multipleOf = m_multipleOf;\r
}\r
+\r
+ /**\r
+ * This method is for setting Minimum to Properties\r
+ *\r
+ * @param min - Minimum value of Properties.\r
+ */\r
inline void setMin(const int &min)\r
{\r
m_min = min;\r
}\r
+\r
+ /**\r
+ * This method is for setting Maximum to Properties\r
+ *\r
+ * @param max - Maximum value of Properties.\r
+ */\r
inline void setMax(const int &max)\r
{\r
m_max = max;\r
}\r
+\r
+ /**\r
+ * This method is for setting multipleOf to Properties\r
+ *\r
+ * @param multipleOf - multipleOf value of Properties.\r
+ */\r
inline void setMultipleOf(const int &multipleOf)\r
{\r
m_multipleOf = multipleOf;\r
}\r
\r
+ /**\r
+ * This method is for setting AllowedValues to Properties\r
+ *\r
+ * @param values - list of AllowedValues of Properties.\r
+ */\r
template <typename T>\r
bool setAllowedValues(const std::vector<T> &values)\r
{\r
m_allowedValues.addValues(values);\r
return true;\r
}\r
+\r
+ /**\r
+ * This method is for getting size of AllowedValues from Properties.\r
+ *\r
+ * @return size of AllowedValues\r
+ */\r
inline int getAllowedValuesSize() const\r
{\r
return m_allowedValues.size();\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues from Properties.\r
+ *\r
+ * @return list of AllowedValues of Properties.\r
+ */\r
inline std::vector<ValueVariant> getAllowedValues()\r
{\r
return m_allowedValues.getValues();\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as integer from Properties.\r
+ *\r
+ * @return list of AllowedValues as integer\r
+ */\r
inline std::vector<int> getAllowedValuesInt()\r
{\r
return m_allowedValues.getValuesInt();\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as String from Properties.\r
+ *\r
+ * @return list of AllowedValues as String\r
+ */\r
inline std::vector<std::string> getAllowedValuesString()\r
{\r
return m_allowedValues.getValuesString();\r
}\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as Double from Properties.\r
+ *\r
+ * @return list of AllowedValues as Double\r
+ */\r
+ inline std::vector<double> getAllowedValuesDouble()\r
+ {\r
+ return m_allowedValues.getValuesDouble();\r
+ }\r
+\r
+ /**\r
+ * This method is for getting AllowedValues as Bool from Properties.\r
+ *\r
+ * @return list of AllowedValues as Bool\r
+ */\r
+ inline std::vector<bool> getAllowedValuesBool()\r
+ {\r
+ return m_allowedValues.getValuesBool();\r
+ }\r
+\r
+ /**\r
+ * This method is for setting Description to Properties\r
+ *\r
+ * @param description - Description as string.\r
+ */\r
inline void setDescription(const std::string &description)\r
{\r
m_description = description;\r
}\r
+\r
+ /**\r
+ * This method is for getting Description from Properties.\r
+ *\r
+ * @return Description as string\r
+ */\r
inline std::string getDescription()\r
{\r
return m_description;\r
}\r
+\r
+ /**\r
+ * This method is for getting UpdateFrequency from Properties.\r
+ *\r
+ * @return UpdateFrequency as int\r
+ */\r
inline int getUpdateFrequencyTime()\r
{\r
return m_updateInterval;\r
}\r
+\r
+ /**\r
+ * This method is for setting UpdateFrequency to Properties\r
+ *\r
+ * @param interval - UpdateFrequency as int.\r
+ */\r
inline void setUpdateFrequencyTime(int interval)\r
{\r
m_updateInterval = interval;\r
}\r
+\r
+ /**\r
+ * This method is for setting Type to Properties\r
+ *\r
+ * @param type - Type as string.\r
+ */\r
void setType(const std::string &type)\r
{\r
m_type = type;\r
}\r
+\r
+ /**\r
+ * This method is for getting Type from Properties.\r
+ *\r
+ * @return Type as string\r
+ */\r
std::string getType()\r
{\r
return m_type;\r
}\r
+\r
+ /**\r
+ * This method is for setting Pattern to Properties\r
+ *\r
+ * @param pattern - Pattern as string.\r
+ */\r
void setPattern(const std::string &pattern)\r
{\r
m_pattern = pattern;\r
}\r
+\r
+\r
+ /**\r
+ * This method is for getting Pattern from Properties.\r
+ *\r
+ * @return Pattern as string\r
+ */\r
std::string getPattern()\r
{\r
return m_pattern;\r
}\r
+\r
+ /**\r
+ * This method is for setting Format to Properties\r
+ *\r
+ * @param format - Format as string.\r
+ */\r
void setFormat(const std::string &format)\r
{\r
m_format = format;\r
}\r
+\r
+ /**\r
+ * This method is for getting Format from Properties.\r
+ *\r
+ * @return Format as string\r
+ */\r
std::string getFormat()\r
{\r
return m_format;\r
}\r
- void setItem(Items *item)\r
+\r
+ /**\r
+ * This method is for setting Items to Properties\r
+ *\r
+ * @param item - pointer to Items\r
+ */\r
+ void setItem(const ItemsPtr &item)\r
{\r
m_items.push_back(item);\r
}\r
- std::vector<Items *> getItems()\r
+\r
+ /**\r
+ * This method is for getting Items from Properties.\r
+ *\r
+ * @return list of pointer to Items\r
+ */\r
+ std::vector<ItemsPtr> const &getItems() const\r
{\r
return m_items;\r
}\r
+\r
+ /**\r
+ * This method is for setting Unique to Properties\r
+ *\r
+ * @param value - Unique as bool\r
+ */\r
void setUnique( int value)\r
{\r
if (value == cJSON_True) m_unique = true;\r
else m_unique = false;\r
}\r
\r
+ /**\r
+ * This method is for getting isUnique from Properties.\r
+ *\r
+ * @return isUnique as bool\r
+ */\r
bool getUnique()\r
{\r
return m_unique;\r
}\r
\r
+ /**\r
+ * This method is for setting AdditionalItems to Properties\r
+ *\r
+ * @param value - AdditionalItems as bool\r
+ */\r
void setAdditionalItems(int value)\r
{\r
if (value == cJSON_True) m_additionalItems = true;\r
else m_additionalItems = false;\r
}\r
\r
+ /**\r
+ * This method is for getting AdditionalItems from Properties.\r
+ *\r
+ * @return AdditionalItems as bool\r
+ */\r
bool getAdditionalItems()\r
{\r
return m_additionalItems;\r
private:\r
std::string m_name;\r
ValueVariant m_value;\r
- int m_max;\r
int m_min;\r
+ int m_max;\r
int m_multipleOf;\r
AllowedValues m_allowedValues;\r
int m_updateInterval;\r
std::string m_description;\r
bool m_unique;\r
bool m_additionalItems;\r
- std::vector<Items *> m_items;\r
+ std::vector<ItemsPtr > m_items;\r
};\r
+\r
+ /** PropertiesPtr - shared Ptr to Properties.*/\r
typedef std::shared_ptr<Properties> PropertiesPtr;\r
\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file AbstractParam.h\r
+ *\r
+ * @brief This file provides data Model for RAML AbstractParam.\r
+ */\r
+\r
#ifndef ABSTRACT_PARAM_H\r
#define ABSTRACT_PARAM_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class AbstractParam\r
+ * @brief This class provides data Model for RAML AbstractParam.\r
+ */\r
class AbstractParam\r
{\r
public:\r
+ /**\r
+ * This method is for getting DefaultValue from AbstractParam.\r
+ *\r
+ * @return DefaultValue as string.\r
+ */\r
virtual std::string getDefaultValue() const;\r
+\r
+ /**\r
+ * This method is for setting DefaultValue to AbstractParam.\r
+ *\r
+ * @param defaultValue - DefaultValue as string\r
+ */\r
virtual void setDefaultValue(const std::string &defaultValue);\r
\r
+ /**\r
+ * This method is for getting Description from AbstractParam.\r
+ *\r
+ * @return Description as string.\r
+ */\r
virtual std::string getDescription() const;\r
+\r
+ /**\r
+ * This method is for setting Description to AbstractParam.\r
+ *\r
+ * @param description - Description as string\r
+ */\r
virtual void setDescription(const std::string &description);\r
\r
+ /**\r
+ * This method is for getting DisplayName from AbstractParam.\r
+ *\r
+ * @return DisplayName as string.\r
+ */\r
virtual std::string getDisplayName() const;\r
+\r
+ /**\r
+ * This method is for setting DisplayName to AbstractParam.\r
+ *\r
+ * @param displayName - DisplayName as string\r
+ */\r
virtual void setDisplayName(const std::string &displayName);\r
\r
+ /**\r
+ * This method is for getting Enumeration from AbstractParam.\r
+ *\r
+ * @return list of enumeration as string.\r
+ */\r
virtual std::list<std::string> getEnumeration() const;\r
+\r
+ /**\r
+ * This method is for setting Enumeration to AbstractParam.\r
+ *\r
+ * @param enumeration - Enumeration as string\r
+ */\r
virtual void setEnumeration(const std::string &enumeration);\r
\r
+ /**\r
+ * This method is for getting Example from AbstractParam.\r
+ *\r
+ * @return Example as string.\r
+ */\r
virtual std::string getExample() const;\r
+\r
+ /**\r
+ * This method is for setting Example to AbstractParam.\r
+ *\r
+ * @param example - Example as string\r
+ */\r
virtual void setExample(const std::string &example);\r
\r
+ /**\r
+ * This method is for getting MaxLength from AbstractParam.\r
+ *\r
+ * @return MaxLength as int.\r
+ */\r
virtual int getMaxLength() const;\r
+\r
+ /**\r
+ * This method is for setting MaxLength to AbstractParam.\r
+ *\r
+ * @param maxLength - MaxLength as int\r
+ */\r
virtual void setMaxLength(int maxLength);\r
\r
+ /**\r
+ * This method is for getting Maximum from AbstractParam.\r
+ *\r
+ * @return Maximum as int.\r
+ */\r
virtual int getMaximum() const;\r
+\r
+ /**\r
+ * This method is for setting Maximum to AbstractParam.\r
+ *\r
+ * @param maximum - Maximum as int\r
+ */\r
virtual void setMaximum(int maximum);\r
\r
+ /**\r
+ * This method is for getting MinLength from AbstractParam.\r
+ *\r
+ * @return MinLength as int.\r
+ */\r
virtual int getMinLength() const;\r
+\r
+ /**\r
+ * This method is for setting MinLength to AbstractParam.\r
+ *\r
+ * @param minLength - MinLength as int\r
+ */\r
virtual void setMinLength(int minLength);\r
\r
+ /**\r
+ * This method is for getting Minimum from AbstractParam.\r
+ *\r
+ * @return Minimum as int.\r
+ */\r
virtual int getMinimum() const;\r
+\r
+ /**\r
+ * This method is for setting Minimum to AbstractParam.\r
+ *\r
+ * @param minimum - Minimum as int\r
+ */\r
virtual void setMinimum(int minimum);\r
\r
+ /**\r
+ * This method is for getting Pattern from AbstractParam.\r
+ *\r
+ * @return Pattern as string.\r
+ */\r
virtual std::string getPattern() const;\r
+\r
+ /**\r
+ * This method is for setting Pattern to AbstractParam.\r
+ *\r
+ * @param pattern - Pattern as string\r
+ */\r
virtual void setPattern(const std::string &pattern) ;\r
\r
+ /**\r
+ * This method is for getting Type from AbstractParam.\r
+ *\r
+ * @return Type as string.\r
+ */\r
virtual std::string getType() const;\r
+\r
+ /**\r
+ * This method is for setting Type to AbstractParam.\r
+ *\r
+ * @param type - Type as string\r
+ */\r
virtual void setType(const std::string &type);\r
\r
+ /**\r
+ * This method is for getting isRepeat from AbstractParam.\r
+ *\r
+ * @return isRepeat as bool.\r
+ */\r
virtual bool isRepeat() const;\r
+\r
+ /**\r
+ * This method is for setting Repeat to AbstractParam.\r
+ *\r
+ * @param repeat - Repeat as bool\r
+ */\r
virtual void setRepeat(bool repeat);\r
\r
+ /**\r
+ * This method is for getting isRequired from AbstractParam.\r
+ *\r
+ * @return isRequired as bool.\r
+ */\r
virtual bool isRequired() const;\r
+\r
+ /**\r
+ * This method is for setting Required to AbstractParam.\r
+ *\r
+ * @param required - Required as bool\r
+ */\r
virtual void setRequired(bool required);\r
\r
+ /**\r
+ * Constructor of AbstractParam.\r
+ */\r
+ AbstractParam() : m_minimum(0), m_maximum(0), m_minLength(0), m_maxLength(0),\r
+ m_repeat(false), m_required(false) {}\r
\r
- AbstractParam() : m_maximum(0), m_minimum(0), m_minLength(0), m_maxLength(0), m_repeat(false),\r
- m_required(false) {}\r
- AbstractParam(const YAML::Node &yamlNode) : m_maximum(0), m_minimum(0), m_minLength(0),\r
- m_maxLength(0), m_repeat(false), m_required(false)\r
+ /**\r
+ * Constructor of AbstractParam.\r
+ *\r
+ * @param yamlNode - Reference to YamlNode for reading the AbstractParam\r
+ *\r
+ */\r
+ AbstractParam(const YAML::Node &yamlNode) : m_minimum(0), m_maximum(0),\r
+ m_minLength(0), m_maxLength(0), m_repeat(false), m_required(false)\r
{\r
readParameters(yamlNode);\r
}\r
std::string m_displayName;\r
std::list<std::string> m_enumeration;\r
std::string m_example;\r
- int m_maxLength;\r
+ int m_minimum;\r
int m_maximum;\r
int m_minLength;\r
- int m_minimum;\r
+ int m_maxLength;\r
std::string m_pattern;\r
bool m_repeat;\r
bool m_required;\r
for ( YAML::const_iterator tt = responseNode.begin(); tt != responseNode.end(); ++tt )\r
{\r
std::string responseCode = READ_NODE_AS_STRING(tt->first);\r
- setResponse(responseCode, std::make_shared<Response>(tt->second, m_includeResolver));\r
+ setResponse(responseCode, std::make_shared<Response>(tt->second,\r
+ m_includeResolver));\r
}\r
}\r
else if (key == Keys::Headers)\r
YAML::Node paramNode = it->second;\r
for ( YAML::const_iterator tt = paramNode.begin(); tt != paramNode.end(); ++tt )\r
{\r
- setQueryParameter(READ_NODE_AS_STRING(tt->first), std::make_shared<QueryParameter>(tt->second));\r
+ setQueryParameter(READ_NODE_AS_STRING(tt->first),\r
+ std::make_shared<QueryParameter>(tt->second));\r
}\r
}\r
else if (key == Keys::Protocols)\r
YAML::Node paramNode = it->second;\r
for ( YAML::const_iterator tt = paramNode.begin(); tt != paramNode.end(); ++tt )\r
{\r
- setBaseUriParameter(READ_NODE_AS_STRING(tt->first), std::make_shared<UriParameter>(tt->second));\r
+ setBaseUriParameter(READ_NODE_AS_STRING(tt->first),\r
+ std::make_shared<UriParameter>(tt->second));\r
}\r
}\r
else if (key == Keys::Body)\r
for ( YAML::const_iterator tt = responseBody.begin(); tt != responseBody.end(); ++tt )\r
{\r
std::string type = READ_NODE_AS_STRING(tt->first);\r
- setRequestBody(type, std::make_shared<RequestResponseBody>(type, tt->second, m_includeResolver));\r
+ setRequestBody(type, std::make_shared<RequestResponseBody>(type, tt->second,\r
+ m_includeResolver));\r
}\r
}\r
else if (key == Keys::IsTrait)\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file Action.h\r
+ *\r
+ * @brief This file provides data Model for RAML Action.\r
+ */\r
+\r
#ifndef ACTION_H\r
#define ACTION_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class Action\r
+ * @brief This class provides data Model for RAML Action.\r
+ */\r
class Action\r
{\r
public:\r
+ /**\r
+ * This method is for getting Type from Action.\r
+ *\r
+ * @return Type as string.\r
+ */\r
virtual ActionType getType() const;\r
+\r
+ /**\r
+ * This method is for setting Type to Action.\r
+ *\r
+ * @param type - Type as string\r
+ */\r
virtual void setType(const ActionType &type);\r
+\r
+ /**\r
+ * This method is for getting Description from Action.\r
+ *\r
+ * @return Description as string.\r
+ */\r
virtual std::string getDescription() const;\r
+\r
+ /**\r
+ * This method is for setting Description to Action.\r
+ *\r
+ * @param description - Description as string\r
+ */\r
virtual void setDescription(const std::string &description);\r
+\r
+ /**\r
+ * This method is for getting Header from Action.\r
+ *\r
+ * @return map of Header name and Pointer to Header.\r
+ */\r
virtual std::map<std::string, HeaderPtr > const &getHeaders() const;\r
+\r
+ /**\r
+ * This method is for setting Header to Action.\r
+ *\r
+ * @param headerName - Header name as string\r
+ * @param header - Pointer to Header\r
+ */\r
virtual void setHeader(const std::string &headerName, const HeaderPtr &header);\r
+\r
+ /**\r
+ * This method is for getting QueryParameter from Action.\r
+ *\r
+ * @return map of QueryParameter name and Pointer to QueryParameter.\r
+ */\r
virtual std::map<std::string, QueryParameterPtr > const &getQueryParameters()const;\r
+\r
+ /**\r
+ * This method is for setting QueryParameter to Action.\r
+ *\r
+ * @param paramName - QueryParameter name as string\r
+ * @param queryParameter - Pointer to QueryParameter\r
+ */\r
virtual void setQueryParameter(const std::string ¶mName,\r
const QueryParameterPtr &queryParameter);\r
\r
+ /**\r
+ * This method is for getting RequestResponseBody from Action.\r
+ *\r
+ * @param bodyType - bodyType name as string\r
+ *\r
+ * @return Pointer to RequestResponseBody\r
+ */\r
virtual RequestResponseBodyPtr getRequestBody(const std::string &bodyType);\r
+\r
+ /**\r
+ * This method is for getting RequestResponseBody from Action.\r
+ *\r
+ * @return map of RequestResponseBody name and Pointer to RequestResponseBody.\r
+ */\r
virtual std::map<std::string, RequestResponseBodyPtr> const &getRequestBody() const;\r
+\r
+ /**\r
+ * This method is for setting RequestResponseBody to Action.\r
+ *\r
+ * @param typeName - RequestResponseBody name as string\r
+ */\r
virtual void setRequestBody(const std::string &typeName);\r
- virtual void setRequestBody(const std::string &typeName , const RequestResponseBodyPtr &body);\r
\r
+ /**\r
+ * This method is for setting Type to Action.\r
+ *\r
+ * @param typeName - RequestResponseBody name as string\r
+ * @param body - Pointer to RequestResponseBody\r
+ */\r
+ virtual void setRequestBody(const std::string &typeName ,\r
+ const RequestResponseBodyPtr &body);\r
+\r
+ /**\r
+ * This method is for getting Response from Action.\r
+ *\r
+ * @param responseCode - Response code as string\r
+ *\r
+ * @return Pointer to Response\r
+ */\r
virtual ResponsePtr getResponse(const std::string &responseCode);\r
+\r
+ /**\r
+ * This method is for getting Response from Action.\r
+ *\r
+ * @return map of response code and Pointer to Response\r
+ */\r
virtual std::map<std::string, ResponsePtr> const &getResponses() const;\r
+\r
+ /**\r
+ * This method is for setting Response to Action.\r
+ *\r
+ * @param responseCode - responseCode as string\r
+ * @param response - Pointer to Response\r
+ */\r
virtual void setResponse(const std::string &responseCode, const ResponsePtr &response);\r
+\r
+ /**\r
+ * This method is for getting Protocols from Action.\r
+ *\r
+ * @return list of Protocols as string.\r
+ */\r
virtual std::list<std::string> const &getProtocols() const;\r
+\r
+ /**\r
+ * This method is for setting Protocols to Action.\r
+ *\r
+ * @param protocol - protocol as string\r
+ */\r
virtual void setProtocol(const std::string &protocol);\r
+\r
+ /**\r
+ * This method is for getting BaseUriParameter from Action.\r
+ *\r
+ * @return map of BaseUriParameter name and pointer to UriParameter.\r
+ */\r
virtual std::map< std::string, UriParameterPtr > const &getBaseUriParameters() const;\r
+\r
+ /**\r
+ * This method is for setting BaseUriParameter to Action.\r
+ *\r
+ * @param paramName - BaseUriParameter name as string\r
+ * @param baseUriParameter - pointer to UriParameter.\r
+ */\r
virtual void setBaseUriParameter(const std::string ¶mName ,\r
const UriParameterPtr &baseUriParameter);\r
+\r
+ /**\r
+ * This method is for getting Traits from Action.\r
+ *\r
+ * @return list of traits as string.\r
+ */\r
virtual std::list<std::string> const &getTraits() const;\r
- virtual void setTrait(const std::string &trait);\r
\r
+ /**\r
+ * This method is for setting Trait to Action.\r
+ *\r
+ * @param trait - trait as string\r
+ */\r
+ virtual void setTrait(const std::string &trait);\r
\r
+ /**\r
+ * Constructor of Action.\r
+ */\r
Action(): m_includeResolver(NULL) { }\r
+\r
+ /**\r
+ * Constructor of Action.\r
+ *\r
+ * @param actionType - type of action in ActionType enum\r
+ * @param yamlNode - Reference to YamlNode for reading the Action\r
+ * @param includeResolver - Reference to IncludeResolver for reading external files\r
+ *\r
+ */\r
Action(const ActionType actionType, const YAML::Node &yamlNode,\r
const IncludeResolverPtr &includeResolver)\r
: m_includeResolver(includeResolver)\r
{\r
readAction(actionType, yamlNode);\r
}\r
- Action(const Action &action) = default;\r
+\r
+ /**\r
+ * copy Constructor of Action.\r
+ */\r
+ Action(const Action &) = default;\r
private:\r
virtual void readAction(const ActionType actionType, const YAML::Node &yamlNode);\r
\r
IncludeResolverPtr m_includeResolver;\r
};\r
\r
+ /** ActionPtr - shared Ptr to Action.*/\r
typedef std::shared_ptr<Action> ActionPtr;\r
}\r
#endif\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file ActionType.h\r
+ *\r
+ * @brief This file provides data Model for RAML ActionType.\r
+ */\r
+\r
#ifndef ACTION_TYPE_H\r
#define ACTION_TYPE_H\r
\r
namespace RAML\r
{\r
+ /** ActionType - This class provides data Model for RAML ActionType. */\r
enum class ActionType\r
{\r
GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, TRACE, NONE\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file DocumentationItem.h\r
+ *\r
+ * @brief This file provides data Model for RAML DocumentationItem.\r
+ */\r
+\r
#ifndef DOCUMENTATION_ITEM_H\r
#define DOCUMENTATION_ITEM_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class DocumentationItem\r
+ * @brief This class provides data Model for RAML DocumentationItem.\r
+ */\r
class DocumentationItem\r
{\r
\r
public:\r
+ /**\r
+ * This method is for getting Title from DocumentationItem.\r
+ *\r
+ * @return title as string.\r
+ */\r
virtual std::string getTitle() const;\r
+\r
+ /**\r
+ * This method is for setting Title to DocumentationItem.\r
+ *\r
+ * @param title - title as string\r
+ */\r
virtual void setTitle(const std::string &title);\r
+\r
+ /**\r
+ * This method is for getting Content from DocumentationItem.\r
+ *\r
+ * @return content as string\r
+ */\r
virtual std::string getContent() const;\r
+\r
+ /**\r
+ * This method is for setting Content to DocumentationItem.\r
+ *\r
+ * @param content - content as string\r
+ */\r
virtual void setContent(const std::string &content);\r
\r
+ /**\r
+ * Constructor of DocumentationItem.\r
+ */\r
DocumentationItem();\r
- DocumentationItem(const std::string &title , const std::string &content) : m_title(title),\r
- m_content(content) {}\r
+\r
+ /**\r
+ * Constructor of Action.\r
+ *\r
+ * @param title - title of Documentation Item\r
+ * @param content - content of Documentation Item\r
+ *\r
+ */\r
+ DocumentationItem(const std::string &title , const std::string &content)\r
+ : m_title(title), m_content(content) {}\r
private:\r
std::string m_title;\r
std::string m_content;\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file FormParameter.h\r
+ *\r
+ * @brief This file provides data Model for RAML FormParameter.\r
+ */\r
+\r
#ifndef FORM_PARAMETER_H\r
#define FORM_PARAMETER_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class FormParameter\r
+ * @brief This class provides data Model for RAML FormParameter.\r
+ */\r
class FormParameter: public AbstractParam\r
{\r
public:\r
+ /**\r
+ * Constructor of FormParameter.\r
+ *\r
+ * @param yamlNode - Reference to YamlNode for reading the FormParameter\r
+ *\r
+ */\r
FormParameter(const YAML::Node &yamlNode) : AbstractParam(yamlNode) {}\r
+\r
+ /**\r
+ * Constructor of FormParameter.\r
+ */\r
FormParameter() {}\r
};\r
+\r
+ /** FormParameterPtr - shared Ptr to FormParameter.*/\r
typedef std::shared_ptr<FormParameter> FormParameterPtr;\r
\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file Header.h\r
+ *\r
+ * @brief This file provides data Model for RAML Header.\r
+ */\r
+\r
#ifndef HEADER_PARAMETER_H\r
#define HEADER_PARAMETER_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class Header\r
+ * @brief This class provides data Model for RAML Header.\r
+ */\r
class Header: public AbstractParam\r
{\r
public:\r
+ /**\r
+ * Constructor of Header.\r
+ *\r
+ * @param yamlNode - Reference to YamlNode for reading the Header\r
+ *\r
+ */\r
Header(const YAML::Node &yamlNode) : AbstractParam(yamlNode) {}\r
+\r
+ /**\r
+ * Constructor of Header.\r
+ */\r
Header() {}\r
};\r
+\r
+ /** HeaderPtr - shared Ptr to Header.*/\r
typedef std::shared_ptr<Header> HeaderPtr;\r
\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file QueryParameter.h\r
+ *\r
+ * @brief This file provides data Model for RAML QueryParameter.\r
+ */\r
+\r
#ifndef QUERY_PARAMETER_H\r
#define QUERY_PARAMETER_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class QueryParameter\r
+ * @brief This class provides data Model for RAML QueryParameter.\r
+ */\r
class QueryParameter: public AbstractParam\r
{\r
public:\r
+ /**\r
+ * Constructor of QueryParameter.\r
+ *\r
+ * @param yamlNode - Reference to YamlNode for reading the QueryParameter\r
+ *\r
+ */\r
QueryParameter(const YAML::Node &yamlNode) : AbstractParam(yamlNode) {}\r
+\r
+ /**\r
+ * Constructor of QueryParameter.\r
+ */\r
QueryParameter() {}\r
};\r
+\r
+ /** QueryParameterPtr - shared Ptr to QueryParameter.*/\r
typedef std::shared_ptr<QueryParameter> QueryParameterPtr;\r
\r
}\r
{\r
return m_baseUriParameters;\r
}\r
- void Raml::setBaseUriParameter(const std::string ¶mName, const UriParameterPtr &uriParameter)\r
+ void Raml::setBaseUriParameter(const std::string ¶mName,\r
+ const UriParameterPtr &uriParameter)\r
{\r
m_baseUriParameters[paramName] = uriParameter;\r
}\r
YAML::Node paramNode = it->second;\r
for ( YAML::const_iterator tt = paramNode.begin(); tt != paramNode.end(); ++tt )\r
{\r
- setBaseUriParameter(READ_NODE_AS_STRING(tt->first), std::make_shared<UriParameter>(tt->second));\r
+ setBaseUriParameter(READ_NODE_AS_STRING(tt->first),\r
+ std::make_shared<UriParameter>(tt->second));\r
}\r
}\r
else if (key == Keys::Protocols)\r
std::pair<std::string, Schema> schema;\r
\r
IncludeResolver::FileType fileType = m_includeResolver->getFileType(tt->second);\r
- if ((fileType == IncludeResolver::FileType::JSON) || (fileType == IncludeResolver::FileType::FILE))\r
+ if ((fileType == IncludeResolver::FileType::JSON) ||\r
+ (fileType == IncludeResolver::FileType::FILE))\r
{\r
- setSchema(key, std::make_shared<Schema>(m_includeResolver->readFromFile(tt->second),\r
- m_includeResolver));\r
+ setSchema(key,\r
+ std::make_shared<Schema>(m_includeResolver->readFromFile(tt->second),\r
+ m_includeResolver));\r
}\r
else\r
{\r
- setSchema(key, std::make_shared<Schema>(READ_NODE_AS_STRING(tt->second), m_includeResolver));\r
+ setSchema(key,\r
+ std::make_shared<Schema>(READ_NODE_AS_STRING(tt->second),\r
+ m_includeResolver));\r
}\r
}\r
}\r
\r
else if (key.compare(0, Keys::Resource.length(), Keys::Resource) == 0)\r
{\r
- setResource(key, std::make_shared<RamlResource>(key, it->second, m_includeResolver, getBaseUri()));\r
+ setResource(key, std::make_shared<RamlResource>(key, it->second, m_includeResolver,\r
+ getBaseUri()));\r
}\r
else if (key == Keys::Traits)\r
{\r
for (auto elem : *tt)\r
{\r
std::string trait = READ_NODE_AS_STRING(elem.first);\r
- setTrait(trait, std::make_shared<Action>(ActionType::NONE, elem.second , m_includeResolver));\r
+ setTrait(trait, std::make_shared<Action>(ActionType::NONE, elem.second ,\r
+ m_includeResolver));\r
}\r
}\r
}\r
for (auto elem : *tt)\r
{\r
std::string type = READ_NODE_AS_STRING(elem.first);\r
- setResourceType(type, std::make_shared<RamlResource>(type, elem.second, m_includeResolver,\r
+ setResourceType(type, std::make_shared<RamlResource>(type, elem.second,\r
+ m_includeResolver,\r
getBaseUri()));\r
\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file Raml.h\r
+ *\r
+ * @brief This file provides data Model for RAML file.\r
+ */\r
+\r
#ifndef RAML_H\r
#define RAML_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class Raml\r
+ * @brief This class provides data Model for RAML file.\r
+ */\r
class Raml\r
{\r
public:\r
+ /**\r
+ * This method is for getting Title from Raml.\r
+ *\r
+ * @return Title as string.\r
+ */\r
virtual std::string getTitle() const;\r
+\r
+ /**\r
+ * This method is for setting Title to Raml.\r
+ *\r
+ * @param title - Title as string\r
+ */\r
virtual void setTitle(const std::string &title);\r
\r
+ /**\r
+ * This method is for getting Version from Raml.\r
+ *\r
+ * @return Version as string.\r
+ */\r
virtual std::string getVersion() const;\r
+\r
+ /**\r
+ * This method is for setting Version to Raml.\r
+ *\r
+ * @param version - Version as string\r
+ */\r
virtual void setVersion(const std::string &version);\r
\r
+ /**\r
+ * This method is for getting BaseUri from Raml.\r
+ *\r
+ * @return BaseUri as string.\r
+ */\r
virtual std::string getBaseUri() const;\r
+\r
+ /**\r
+ * This method is for setting BaseUri to Raml.\r
+ *\r
+ * @param baseUri - BaseUri as string\r
+ */\r
virtual void setBaseUri(const std::string &baseUri);\r
\r
+ /**\r
+ * This method is for getting Protocols from Raml.\r
+ *\r
+ * @return list of Protocols as string.\r
+ */\r
virtual std::list<std::string> const &getProtocols() const;\r
+\r
+ /**\r
+ * This method is for setting Protocols to Raml.\r
+ *\r
+ * @param protocol - Protocol as string\r
+ */\r
virtual void setProtocol(const std::string &protocol);\r
\r
\r
+ /**\r
+ * This method is for getting BaseUriParameter from Raml.\r
+ *\r
+ * @return map of BaseUriParameter name and Pointer to UriParameter.\r
+ */\r
virtual std::map<std::string, UriParameterPtr> const &getBaseUriParameters() const;\r
- virtual void setBaseUriParameter(const std::string ¶mName, const UriParameterPtr &uriParameter);\r
\r
+ /**\r
+ * This method is for setting BaseUriParameter to Raml.\r
+ *\r
+ * @param paramName - name of BaseUriParameter as string\r
+ * @param uriParameter - pointer to UriParameter\r
+ */\r
+ virtual void setBaseUriParameter(const std::string ¶mName,\r
+ const UriParameterPtr &uriParameter);\r
+\r
+\r
+ /**\r
+ * This method is for getting MediaType from Raml.\r
+ *\r
+ * @return Title as string.\r
+ */\r
virtual std::string getMediaType() const;\r
+\r
+ /**\r
+ * This method is for setting MediaType to Raml.\r
+ *\r
+ * @param mediaType - MediaType as string\r
+ */\r
virtual void setMediaType(const std::string &mediaType);\r
\r
+ /**\r
+ * This method is for getting Schemas from Raml.\r
+ *\r
+ * @return list of Schemas name and Pointer to Schema as pair.\r
+ */\r
virtual std::list<std::pair<std::string, SchemaPtr> > const &getSchemas() const;\r
+\r
+ /**\r
+ * This method is for setting Schemas to Raml.\r
+ *\r
+ * @param schemaName - name of schema as string\r
+ * @param schema - pointer to Schema\r
+ */\r
virtual void setSchema(const std::string &schemaName, const SchemaPtr &schema);\r
\r
+ /**\r
+ * This method is for getting ResourceTypes from Raml.\r
+ *\r
+ * @return list of ResourceTypes name and Pointer to RamlResource as pair.\r
+ */\r
virtual std::list<std::pair<std::string, RamlResourcePtr> > const &getResourceTypes() const;\r
- virtual void setResourceType(const std::string &typeName, const RamlResourcePtr &resourceType);\r
\r
+ /**\r
+ * This method is for setting ResourceTypes to Raml.\r
+ *\r
+ * @param typeName - name of ResourceType as string\r
+ * @param resourceType - pointer to RamlResource\r
+ */\r
+ virtual void setResourceType(const std::string &typeName,\r
+ const RamlResourcePtr &resourceType);\r
+\r
+ /**\r
+ * This method is for getting Traits from Raml.\r
+ *\r
+ * @return list of Traits name and Pointer to Action as pair.\r
+ */\r
virtual std::list<std::pair<std::string, ActionPtr> > const &getTraits() const;\r
+\r
+ /**\r
+ * This method is for setting Traits to Raml.\r
+ *\r
+ * @param traitName - name of Trait as string\r
+ * @param trait - pointer to Action\r
+ */\r
virtual void setTrait(const std::string &traitName, const ActionPtr &trait);\r
\r
+ /**\r
+ * This method is for getting Resource from Raml.\r
+ *\r
+ * @param resourceName - name of Resource as string\r
+ *\r
+ * @return Pointer to Resource\r
+ */\r
virtual RamlResourcePtr getResource(const std::string &resourceName);\r
+\r
+ /**\r
+ * This method is for getting Resource from Raml.\r
+ *\r
+ * @return map of Resource name and Pointer to Resource\r
+ */\r
virtual std::map<std::string, RamlResourcePtr> const &getResources() const;\r
- virtual void setResource(const std::string &resourceKey, const RamlResourcePtr &resource);\r
\r
+ /**\r
+ * This method is for setting Resource to Raml.\r
+ *\r
+ * @param resourceKey - name of Resource as string\r
+ * @param resource - pointer to Resource\r
+ */\r
+ virtual void setResource(const std::string &resourceKey,\r
+ const RamlResourcePtr &resource);\r
+\r
+ /**\r
+ * This method is for setting DocumentationItem to Raml.\r
+ *\r
+ * @param documentationItem - pointer to DocumentationItem\r
+ */\r
virtual void setDocumentationItem(const std::shared_ptr<DocumentationItem> &documentationItem);\r
+\r
+ /**\r
+ * This method is for getting DocumentationItem from Raml.\r
+ *\r
+ * @return list of DocumentationItem\r
+ */\r
virtual std::list<std::shared_ptr<DocumentationItem> > const &getDocumentation() const;\r
\r
+ /**\r
+ * This method is for setting Raml object reading from Yaml nodes\r
+ *\r
+ * @param yamlNode - Reference to YamlNode for reading into Raml object\r
+ */\r
void readRamlFromYaml(const YAML::Node &yamlNode);\r
+\r
+ /**\r
+ * Constructor of Raml.\r
+ */\r
Raml() : m_includeResolver(std::make_shared<IncludeResolver>()) {}\r
- Raml(const std::string &fileLocation,\r
- const std::string &ramlName) : m_includeResolver(std::make_shared<IncludeResolver>(fileLocation))\r
+\r
+ /**\r
+ * Constructor of Raml.\r
+ *\r
+ * @param fileLocation - RAML configuration file path.\r
+ * @param ramlName - RAML configuration file Name\r
+ *\r
+ * NOTE: Constructor would throw RamlException if any error occured.\r
+ */\r
+ Raml(const std::string &fileLocation, const std::string &ramlName)\r
+ : m_includeResolver(std::make_shared<IncludeResolver>(fileLocation))\r
{\r
try\r
{\r
IncludeResolverPtr m_includeResolver;\r
};\r
\r
+ /** RamlPtr - shared Ptr to Raml.*/\r
typedef std::shared_ptr<Raml> RamlPtr;\r
\r
}\r
setDisplayName(READ_NODE_AS_STRING(it->second));\r
else if (key == Keys::Description)\r
setDescription(READ_NODE_AS_STRING(it->second));\r
- else if (std::find(Keys::ActionType.begin(), Keys::ActionType.end(), key) != Keys::ActionType.end())\r
+ else if (std::find(Keys::ActionType.begin(), Keys::ActionType.end(), key) !=\r
+ Keys::ActionType.end())\r
{\r
ActionType actionType = GET_ACTION_TYPE(key);\r
\r
- setAction(actionType, std::make_shared<Action>(actionType, it->second, m_includeResolver));\r
+ setAction(actionType, std::make_shared<Action>(actionType, it->second,\r
+ m_includeResolver));\r
}\r
else if (key == Keys::UriParameters)\r
{\r
YAML::Node paramNode = it->second;\r
for ( YAML::const_iterator tt = paramNode.begin(); tt != paramNode.end(); ++tt )\r
{\r
- setUriParameter(READ_NODE_AS_STRING(tt->first), std::make_shared<UriParameter>(tt->second));\r
+ setUriParameter(READ_NODE_AS_STRING(tt->first),\r
+ std::make_shared<UriParameter>(tt->second));\r
}\r
}\r
else if (key == Keys::BaseUriParameters)\r
YAML::Node paramNode = it->second;\r
for ( YAML::const_iterator tt = paramNode.begin(); tt != paramNode.end(); ++tt )\r
{\r
- setBaseUriParameter(READ_NODE_AS_STRING(tt->first), std::make_shared<UriParameter>(tt->second));\r
+ setBaseUriParameter(READ_NODE_AS_STRING(tt->first),\r
+ std::make_shared<UriParameter>(tt->second));\r
}\r
}\r
else if (key == Keys::IsTrait)\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file RamlResource.h\r
+ *\r
+ * @brief This file provides data Model for RAML RamlResource.\r
+ */\r
+\r
#ifndef RESOURCE_H\r
#define RESOURCE_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class RamlResource\r
+ * @brief This class provides data Model for RAML RamlResource.\r
+ */\r
class RamlResource\r
{\r
public:\r
+ /**\r
+ * This method is for getting DisplayName from RamlResource.\r
+ *\r
+ * @return DisplayName as string.\r
+ */\r
virtual std::string getDisplayName() const;\r
+\r
+ /**\r
+ * This method is for setting DisplayName to RamlResource.\r
+ *\r
+ * @param displayName - DisplayName as string\r
+ */\r
virtual void setDisplayName(const std::string &displayName);\r
\r
+ /**\r
+ * This method is for getting Description from RamlResource.\r
+ *\r
+ * @return Description as string.\r
+ */\r
virtual std::string getDescription() const;\r
+\r
+ /**\r
+ * This method is for setting Description to RamlResource.\r
+ *\r
+ * @param description - Description as string\r
+ */\r
virtual void setDescription(const std::string &description);\r
\r
+ /**\r
+ * This method is for getting ParentUri from RamlResource.\r
+ *\r
+ * @return ParentUri as string.\r
+ */\r
virtual std::string getParentUri() const;\r
+\r
+ /**\r
+ * This method is for setting ParentUri to RamlResource.\r
+ *\r
+ * @param parentUri - ParentUri as string\r
+ */\r
virtual void setParentUri(const std::string &parentUri);\r
\r
+ /**\r
+ * This method is for getting RelativeUri from RamlResource.\r
+ *\r
+ * @return RelativeUri as string.\r
+ */\r
virtual std::string getRelativeUri() const;\r
+\r
+ /**\r
+ * This method is for setting RelativeUri to RamlResource.\r
+ *\r
+ * @param relativeUri - RelativeUri as string\r
+ */\r
virtual void setRelativeUri(const std::string &relativeUri);\r
\r
+ /**\r
+ * This method is for getting UriParameter from RamlResource.\r
+ *\r
+ * @return map of UriParameter name and Pointer to UriParameter.\r
+ */\r
virtual std::map<std::string, UriParameterPtr> const &getUriParameters() const;\r
+\r
+ /**\r
+ * This method is for setting UriParameter to RamlResource.\r
+ *\r
+ * @param paramName - name of UriParameter as string\r
+ * @param uriParameter - pointer to UriParameter\r
+ */\r
virtual void setUriParameter(const std::string ¶mName, const UriParameterPtr &uriParameter);\r
\r
+ /**\r
+ * This method is for getting BaseUriParameter from RamlResource.\r
+ *\r
+ * @return map of BaseUriParameter name and Pointer to UriParameter.\r
+ */\r
virtual std::map<std::string, UriParameterPtr > const &getBaseUriParameters() const;\r
+\r
+ /**\r
+ * This method is for setting BaseUriParameter to RamlResource.\r
+ *\r
+ * @param paramName - name of BaseUriParameter as string\r
+ * @param baseUriParameter - pointer to UriParameter\r
+ */\r
virtual void setBaseUriParameter(const std::string ¶mName,\r
const UriParameterPtr &baseUriParameter);\r
\r
+ /**\r
+ * This method is for getting Action from RamlResource.\r
+ *\r
+ * @param actionType - type of action as ActionType\r
+ *\r
+ * @return Pointer to Action.\r
+ */\r
virtual ActionPtr getAction(ActionType actionType);\r
+\r
+ /**\r
+ * This method is for getting Action from RamlResource.\r
+ *\r
+ * @return map of ActionType and Pointer to Action.\r
+ */\r
virtual std::map<ActionType , ActionPtr> const &getActions() const;\r
+\r
+ /**\r
+ * This method is for setting Action to RamlResource.\r
+ *\r
+ * @param actiontype - type of action\r
+ * @param action - pointer to Action\r
+ */\r
virtual void setAction(const ActionType &actiontype , const ActionPtr &action );\r
\r
+ /**\r
+ * This method is for getting child Resource from RamlResource.\r
+ *\r
+ * @return map of Resource name and Pointer to RamlResource.\r
+ */\r
virtual std::map<std::string, std::shared_ptr<RamlResource> > const &getResources() const;\r
+\r
+ /**\r
+ * This method is for setting child Resource to RamlResource.\r
+ *\r
+ * @param resourceName - name of Resource as string\r
+ * @param resources - pointer to RamlResource\r
+ */\r
virtual void setResource(const std::string &resourceName,\r
const std::shared_ptr<RamlResource> &resources);\r
\r
+ /**\r
+ * This method is for getting Traits from RamlResource.\r
+ *\r
+ * @return list of Traits name.\r
+ */\r
virtual std::list<std::string> const &getTraits() const;\r
+\r
+ /**\r
+ * This method is for setting Traits to RamlResource.\r
+ *\r
+ * @param trait - name of Traits\r
+ */\r
virtual void setTrait(const std::string &trait);\r
\r
+ /**\r
+ * This method is for getting ResourceType from RamlResource.\r
+ *\r
+ * @return ResourceType name.\r
+ */\r
virtual std::string getResourceType() const;\r
+\r
+ /**\r
+ * This method is for setting ResourceType to RamlResource.\r
+ *\r
+ * @param type - name of ResourceType\r
+ */\r
virtual void setResourceType(const std::string &type);\r
\r
+ /**\r
+ * This method is for getting ResourceUri from RamlResource.\r
+ *\r
+ * @return ResourceUri as string.\r
+ */\r
virtual std::string getResourceUri() const;\r
+\r
+ /**\r
+ * Constructor of RamlResource.\r
+ */\r
RamlResource(): m_includeResolver(NULL) {}\r
+\r
+ /**\r
+ * Constructor of RamlResource.\r
+ *\r
+ * @param resourceKey - name of the Resource\r
+ * @param yamlNode - Reference to YamlNode for reading the RamlResource\r
+ * @param includeResolver - Reference to IncludeResolver for reading external files\r
+ * @param parentUri - Uri of the Parent to form the Absolute Uri\r
+ *\r
+ */\r
RamlResource(const std::string resourceKey, const YAML::Node &yamlNode ,\r
const IncludeResolverPtr &includeResolver,\r
const std::string &parentUri) : m_includeResolver(includeResolver)\r
IncludeResolverPtr m_includeResolver;\r
};\r
\r
+ /** RamlResourcePtr - shared Ptr to RamlResource.*/\r
typedef std::shared_ptr<RamlResource> RamlResourcePtr;\r
}\r
#endif\r
if (key == Keys::Schema)\r
{\r
IncludeResolver::FileType fileType = m_includeResolver->getFileType(it->second);\r
- if ((fileType == IncludeResolver::FileType::JSON) || (fileType == IncludeResolver::FileType::FILE))\r
+ if ((fileType == IncludeResolver::FileType::JSON) ||\r
+ (fileType == IncludeResolver::FileType::FILE))\r
{\r
- setSchema(std::make_shared<Schema>(m_includeResolver->readFromFile(it->second), m_includeResolver));\r
+ setSchema(std::make_shared<Schema>(m_includeResolver->readFromFile(it->second),\r
+ m_includeResolver));\r
}\r
else\r
{\r
YAML::Node paramNode = it->second;\r
for ( YAML::const_iterator tt = paramNode.begin(); tt != paramNode.end(); ++tt )\r
{\r
- setFormParameter(READ_NODE_AS_STRING(tt->first), std::make_shared<FormParameter>(tt->second));\r
+ setFormParameter(READ_NODE_AS_STRING(tt->first),\r
+ std::make_shared<FormParameter>(tt->second));\r
}\r
}\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file RequestResponseBody.h\r
+ *\r
+ * @brief This file provides data Model for RAML RequestResponseBody.\r
+ */\r
+\r
#ifndef REQUEST_RESPONSE_BODY_H\r
#define REQUEST_RESPONSE_BODY_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class RequestResponseBody\r
+ * @brief This class provides data Model for RAML RequestResponseBody.\r
+ */\r
class RequestResponseBody\r
{\r
public:\r
+ /**\r
+ * This method is for getting Type from RequestResponseBody.\r
+ *\r
+ * @return type as string.\r
+ */\r
virtual std::string getType() const;\r
+\r
+ /**\r
+ * This method is for setting Type to RequestResponseBody.\r
+ *\r
+ * @param type - type of RequestResponseBody\r
+ */\r
virtual void setType(const std::string &type);\r
+\r
+ /**\r
+ * This method is for getting Schema from RequestResponseBody.\r
+ *\r
+ * @return pointer to Schema.\r
+ */\r
virtual SchemaPtr const &getSchema() const;\r
+\r
+ /**\r
+ * This method is for setting Schema to RequestResponseBody.\r
+ *\r
+ * @param schema - pointer to Schema\r
+ */\r
virtual void setSchema(const SchemaPtr &schema);\r
+\r
+ /**\r
+ * This method is for getting Example from RequestResponseBody.\r
+ *\r
+ * @return Example as string.\r
+ */\r
virtual std::string getExample() const;\r
+\r
+ /**\r
+ * This method is for setting Example to RequestResponseBody.\r
+ *\r
+ * @param example - Example as string\r
+ */\r
virtual void setExample(const std::string &example);\r
+\r
+ /**\r
+ * This method is for getting FormParameter from RequestResponseBody.\r
+ *\r
+ * @return map of pointer to param Name and pointer to FormParameter.\r
+ */\r
virtual std::map<std::string, FormParameterPtr> const &getFormParameters() const;\r
- virtual void setFormParameter(const std::string ¶mName, const FormParameterPtr &formParameter);\r
+\r
+ /**\r
+ * This method is for setting FormParameter to RequestResponseBody.\r
+ *\r
+ * @param paramName - Name of FormParameter\r
+ * @param formParameter - pointer to FormParameter\r
+ */\r
+ virtual void setFormParameter(const std::string ¶mName,\r
+ const FormParameterPtr &formParameter);\r
+\r
+ /**\r
+ * Constructor of RequestResponseBody.\r
+ */\r
RequestResponseBody(): m_schema(NULL), m_includeResolver(NULL) {}\r
+\r
+ /**\r
+ * Constructor of RequestResponseBody.\r
+ *\r
+ * @param type - type of request response body\r
+ *\r
+ */\r
RequestResponseBody(const std::string type) : m_type(type), m_schema(NULL),\r
m_includeResolver(NULL) {}\r
+\r
+ /**\r
+ * Constructor of RequestResponseBody.\r
+ *\r
+ * @param type - type of request response body\r
+ * @param yamlNode - Reference to YamlNode for reading the RequestResponseBody\r
+ * @param includeResolver - Reference to IncludeResolver for reading external files\r
+ *\r
+ */\r
RequestResponseBody(const std::string type, const YAML::Node &yamlNode,\r
- const IncludeResolverPtr &includeResolver): m_schema(NULL), m_includeResolver(includeResolver) { readRequestResponseBody(type, yamlNode); }\r
+ const IncludeResolverPtr &includeResolver): m_schema(NULL),\r
+ m_includeResolver(includeResolver)\r
+ { readRequestResponseBody(type, yamlNode); }\r
\r
private:\r
- virtual void readRequestResponseBody(const std::string &type, const YAML::Node &yamlNode) ;\r
+ virtual void readRequestResponseBody(const std::string &type,\r
+ const YAML::Node &yamlNode) ;\r
private:\r
std::string m_type;\r
SchemaPtr m_schema;\r
IncludeResolverPtr m_includeResolver;\r
};\r
\r
+ /** RequestResponseBodyPtr - shared Ptr to RequestResponseBody.*/\r
typedef std::shared_ptr<RequestResponseBody> RequestResponseBodyPtr;\r
}\r
#endif\r
for ( YAML::const_iterator tt = responseBody.begin(); tt != responseBody.end(); ++tt )\r
{\r
std::string type = READ_NODE_AS_STRING(tt->first);\r
- setResponseBody(type, std::make_shared<RequestResponseBody>(type, tt->second, m_includeResolver));\r
+ setResponseBody(type, std::make_shared<RequestResponseBody>(type, tt->second,\r
+ m_includeResolver));\r
}\r
}\r
else if (key == Keys::Headers)\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file Response.h\r
+ *\r
+ * @brief This file provides data Model for RAML Response.\r
+ */\r
+\r
#ifndef RESPONSE_H\r
#define RESPONSE_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class Response\r
+ * @brief This class provides data Model for RAML Response.\r
+ */\r
class Response\r
{\r
public:\r
+ /**\r
+ * This method is for getting Headers from Response.\r
+ *\r
+ * @return map of headerName and Pointer to Header.\r
+ */\r
virtual std::map<std::string, HeaderPtr> const &getHeaders() const;\r
+\r
+ /**\r
+ * This method is for setting Header to Response.\r
+ *\r
+ * @param headerName - header Name\r
+ * @param header - pointer to Header Object.\r
+ */\r
virtual void setHeader(const std::string &headerName, const HeaderPtr &header);\r
+\r
+ /**\r
+ * This method is for getting Description from Response.\r
+ *\r
+ * @return Description string.\r
+ */\r
virtual std::string getDescription() const;\r
+\r
+ /**\r
+ * This method is for setting Description to Response.\r
+ *\r
+ * @param description - description string\r
+ */\r
virtual void setDescription(const std::string &description);\r
+\r
+ /**\r
+ * This method is for setting ResponseBody to Response.\r
+ *\r
+ * @param typeName - response body typeName\r
+ */\r
virtual void setResponseBody(const std::string &typeName);\r
+\r
+ /**\r
+ * This method is for setting ResponseBody to Response.\r
+ *\r
+ * @param type - response body typeName\r
+ * @param body - Pointer to RequestResponseBody\r
+ */\r
virtual void setResponseBody(const std::string &type, const RequestResponseBodyPtr &body) ;\r
+\r
+ /**\r
+ * This method is for getting ResponseBody from Response.\r
+ *\r
+ * @return map of body type and Pointer to RequestResponseBody.\r
+ */\r
virtual std::map<std::string, RequestResponseBodyPtr> const &getResponseBody() const;\r
- virtual RequestResponseBodyPtr getResponseBody(const std::string &bodyType);\r
\r
+ /**\r
+ * This method is for getting ResponseBody from Response.\r
+ *\r
+ * @param bodyType - response body type\r
+ *\r
+ * @return Pointer to RequestResponseBody.\r
+ */\r
+ virtual RequestResponseBodyPtr getResponseBody(const std::string &bodyType);\r
\r
+ /**\r
+ * Constructor of Response.\r
+ */\r
Response() : m_includeResolver(NULL) {}\r
+\r
+ /**\r
+ * Constructor of Response.\r
+ *\r
+ * @param yamlNode - Reference to YamlNode for reading the Response\r
+ * @param includeResolver - Reference to IncludeResolver for reading external files\r
+ *\r
+ */\r
Response(const YAML::Node &yamlNode,\r
- const IncludeResolverPtr &includeResolver): m_includeResolver(includeResolver) { readResponse(yamlNode);}\r
+ const IncludeResolverPtr &includeResolver): m_includeResolver(includeResolver)\r
+ { readResponse(yamlNode);}\r
private:\r
void readResponse(const YAML::Node &yamlNode) ;\r
private:\r
std::map<std::string, HeaderPtr> m_headers;\r
IncludeResolverPtr m_includeResolver;\r
};\r
+\r
+ /** ResponsePtr - shared Ptr to Response.*/\r
typedef std::shared_ptr<Response> ResponsePtr;\r
}\r
#endif\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file Schema.h\r
+ *\r
+ * @brief This file provides data Model for RAML Schema.\r
+ */\r
+\r
#ifndef SCHEMAS_H\r
#define SCHEMAS_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class Schema\r
+ * @brief This class provides data Model for RAML Schema.\r
+ */\r
class Schema\r
{\r
public:\r
+ /**\r
+ * This method is for getting CJson object of schema.\r
+ *\r
+ * @return pointer to cJSON.\r
+ */\r
virtual cJSON *getJson() const;\r
+\r
+ /**\r
+ * This method is for setting schema as CJson object.\r
+ *\r
+ * @param cjson - Cjson pointer.\r
+ */\r
virtual void setJson(cJSON *cjson);\r
+\r
+ /**\r
+ * This method is for getting schema as string.\r
+ *\r
+ * @return string.\r
+ */\r
virtual std::string getSchema() const;\r
+\r
+ /**\r
+ * This method is for setting schema as string.\r
+ *\r
+ * @param schema - schema string.\r
+ */\r
virtual void setSchema(const std::string &schema);\r
+\r
+ /**\r
+ * This method is for getting Properties from JsonSchema.\r
+ *\r
+ * @return pointer to JsonSchema.\r
+ */\r
virtual JsonSchemaPtr const &getProperties() const;\r
\r
- Schema(const std::string &schema, const IncludeResolverPtr &includeResolver): m_schema(schema) ,\r
- m_cjson(cJSON_Parse(schema.c_str())),\r
+ /**\r
+ * Constructor of Schema.\r
+ *\r
+ * @param schema - contents of schema to be parsed\r
+ * @param includeResolver - Reference to IncludeResolver for reading external files\r
+ *\r
+ */\r
+ Schema(const std::string &schema, const IncludeResolverPtr &includeResolver):\r
+ m_schema(schema) , m_cjson(cJSON_Parse(schema.c_str())),\r
m_resProperties(std::make_shared<JsonSchema>(m_cjson, includeResolver) ) ,\r
m_includeResolver(includeResolver) {}\r
- Schema(): m_cjson(NULL), m_includeResolver(NULL), m_resProperties(std::make_shared<JsonSchema>()) {}\r
+\r
+ /**\r
+ * Constructor of Schema.\r
+ */\r
+ Schema(): m_cjson(NULL), m_resProperties(std::make_shared<JsonSchema>()),\r
+ m_includeResolver(NULL) {}\r
+\r
+ /**\r
+ * Destructor of Schema.\r
+ */\r
~Schema() { cJSON_Delete(m_cjson); }\r
\r
private:\r
- cJSON *m_cjson;\r
std::string m_schema;\r
+ cJSON *m_cjson;\r
JsonSchemaPtr m_resProperties;\r
IncludeResolverPtr m_includeResolver;\r
};\r
+\r
+ /** SchemaPtr - shared Ptr to Schema.*/\r
typedef std::shared_ptr<Schema> SchemaPtr;\r
\r
}\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file UriParameter.h\r
+ *\r
+ * @brief This file provides data Model for RAML UriParameters.\r
+ */\r
+\r
#ifndef URI_PARAMETER_H\r
#define URI_PARAMETER_H\r
\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class UriParameter\r
+ * @brief This class provides data Model for RAML UriParameters.\r
+ */\r
class UriParameter: public AbstractParam\r
{\r
public:\r
+ /**\r
+ * Constructor of UriParameter.\r
+ *\r
+ * @param yamlNode - Reference to YamlNode for reading the UriParameter\r
+ *\r
+ */\r
UriParameter(const YAML::Node &yamlNode) : AbstractParam(yamlNode) {}\r
+\r
+ /**\r
+ * Constructor of UriParameter.\r
+ */\r
UriParameter() {}\r
};\r
+\r
+ /** UriParameterPtr - shared Ptr to UriParameter.*/\r
+\r
typedef std::shared_ptr<UriParameter> UriParameterPtr;\r
\r
}\r