From 8bb68fb98a181017fc3dd37e9a3bdd253a13642f Mon Sep 17 00:00:00 2001 From: Muhammad Nawaz Date: Sat, 15 Jun 2024 15:12:33 +0500 Subject: [PATCH] Formatted code and clang-tidy fixes --- example/example.cpp | 18 +++++++++--------- include/utils/common.hpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/example/example.cpp b/example/example.cpp index f1c523e..dea2322 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -11,43 +11,43 @@ int main() { - OASValidator oas_validator(SPEC_PATH); + OASValidator OasValidator(SPEC_PATH); std::string err_msg; - if (ValidationError::NONE != oas_validator.ValidateRoute("GETT", "/test/dummy", err_msg)) { + if (ValidationError::NONE != OasValidator.ValidateRoute("GETT", "/test/dummy", err_msg)) { std::cout << err_msg << std::endl; } - if (ValidationError::NONE != oas_validator.ValidateRoute("GET", "/test/dummy", err_msg)) { + if (ValidationError::NONE != OasValidator.ValidateRoute("GET", "/test/dummy", err_msg)) { std::cout << err_msg << std::endl; } - if (ValidationError::NONE != oas_validator.ValidateRoute("GET", "/test/invalid", err_msg)) { + if (ValidationError::NONE != OasValidator.ValidateRoute("GET", "/test/invalid", err_msg)) { std::cout << err_msg << std::endl; } - if (ValidationError::NONE != oas_validator.ValidatePathParam("GET", "/test/integer_simple_true/1001", err_msg)) { + if (ValidationError::NONE != OasValidator.ValidatePathParam("GET", "/test/integer_simple_true/1001", err_msg)) { std::cout << err_msg << std::endl; } if (ValidationError::NONE != - oas_validator.ValidatePathParam("GET", "/test/integer_simple_true/not_an_integer", err_msg)) { + OasValidator.ValidatePathParam("GET", "/test/integer_simple_true/not_an_integer", err_msg)) { std::cout << err_msg << std::endl; } if (ValidationError::NONE != - oas_validator.ValidateQueryParam("GET", "/test/query_integer_form_true?param=not_an_integer", err_msg)) { + OasValidator.ValidateQueryParam("GET", "/test/query_integer_form_true?param=not_an_integer", err_msg)) { std::cout << err_msg << std::endl; } std::unordered_map headers; headers["intHeader"] = "not_an_integer"; - if (ValidationError::NONE != oas_validator.ValidateHeaders("GET", "/test/header_single1", headers, err_msg)) { + if (ValidationError::NONE != OasValidator.ValidateHeaders("GET", "/test/header_single1", headers, err_msg)) { std::cout << err_msg << std::endl; } if (ValidationError::NONE != - oas_validator.ValidateRequest( + OasValidator.ValidateRequest( "POST", "/test/all/123/abc/str1,str2/" "field1,0,field2,string?param4=string1¶m4=string2¶m5=field1,0,field2,string¶m6=field1,0,field2," diff --git a/include/utils/common.hpp b/include/utils/common.hpp index 4065b37..d712eb2 100644 --- a/include/utils/common.hpp +++ b/include/utils/common.hpp @@ -27,9 +27,9 @@ class ValidatorInitExc: public std::exception } }; -#define CHECK_ERROR(err) \ +#define CHECK_ERROR(err) \ if (ValidationError::NONE != (err)) { \ - return err; \ + return err; \ } struct ParamRange