Skip to content

Commit

Permalink
Formatted code and clang-tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nawaz1991 committed Jul 9, 2024
1 parent 8ce9638 commit 8bb68fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions example/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, std::string> 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&param4=string2&param5=field1,0,field2,string&param6=field1,0,field2,"
Expand Down
4 changes: 2 additions & 2 deletions include/utils/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8bb68fb

Please sign in to comment.