| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (c) 2024 Muhammad Nawaz | ||
| 3 | * Licensed under the MIT License. See LICENSE file for more information. | ||
| 4 | */ | ||
| 5 | // [ END OF LICENSE c6bd0f49d040fca8d8a9cb05868e66aa63f0e2e0 ] | ||
| 6 | |||
| 7 | #include "oas_validator.hpp" | ||
| 8 | |||
| 9 | #include "oas_validator_imp.hpp" | ||
| 10 | |||
| 11 | 7 | OASValidator::OASValidator(const std::string& oas_specs, | |
| 12 | 7 | const std::unordered_map<std::string, std::unordered_set<std::string>>& method_map) | |
| 13 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 3 taken 1 times.
|
7 | : impl_(new OASValidatorImp(oas_specs, method_map)) |
| 14 | { | ||
| 15 | 6 | } | |
| 16 | |||
| 17 | ✗ | OASValidator::OASValidator(const OASValidator& other) | |
| 18 | ✗ | : impl_(new OASValidatorImp(*other.impl_)) | |
| 19 | { | ||
| 20 | ✗ | } | |
| 21 | |||
| 22 | ✗ | OASValidator& OASValidator::operator=(const OASValidator& other) | |
| 23 | { | ||
| 24 | ✗ | if (this == &other) { | |
| 25 | ✗ | return *this; | |
| 26 | } | ||
| 27 | |||
| 28 | ✗ | delete impl_; | |
| 29 | ✗ | impl_ = new OASValidatorImp(*other.impl_); | |
| 30 | ✗ | return *this; | |
| 31 | } | ||
| 32 | |||
| 33 | 12 | ValidationError OASValidator::ValidateRoute(const std::string& method, const std::string& http_path, | |
| 34 | std::string& error_msg) | ||
| 35 | { | ||
| 36 | 12 | return impl_->ValidateRoute(method, http_path, error_msg); | |
| 37 | } | ||
| 38 | |||
| 39 | 4 | ValidationError OASValidator::ValidateBody(const std::string& method, const std::string& http_path, | |
| 40 | const std::string& json_body, std::string& error_msg) | ||
| 41 | { | ||
| 42 | 4 | return impl_->ValidateBody(method, http_path, json_body, error_msg); | |
| 43 | } | ||
| 44 | 12 | ValidationError OASValidator::ValidatePathParam(const std::string& method, const std::string& http_path, | |
| 45 | std::string& error_msg) | ||
| 46 | { | ||
| 47 | 12 | return impl_->ValidatePathParam(method, http_path, error_msg); | |
| 48 | } | ||
| 49 | |||
| 50 | 6 | ValidationError OASValidator::ValidateQueryParam(const std::string& method, const std::string& http_path, | |
| 51 | std::string& error_msg) | ||
| 52 | { | ||
| 53 | 6 | return impl_->ValidateQueryParam(method, http_path, error_msg); | |
| 54 | } | ||
| 55 | |||
| 56 | 6 | ValidationError OASValidator::ValidateHeaders(const std::string& method, const std::string& http_path, | |
| 57 | const std::unordered_map<std::string, std::string>& headers, | ||
| 58 | std::string& error_msg) | ||
| 59 | { | ||
| 60 | 6 | return impl_->ValidateHeaders(method, http_path, headers, error_msg); | |
| 61 | } | ||
| 62 | |||
| 63 | 17 | ValidationError OASValidator::ValidateRequest(const std::string& method, const std::string& http_path, | |
| 64 | std::string& error_msg) | ||
| 65 | { | ||
| 66 | 17 | return impl_->ValidateRequest(method, http_path, error_msg); | |
| 67 | } | ||
| 68 | |||
| 69 | 1 | ValidationError OASValidator::ValidateRequest(const std::string& method, const std::string& http_path, | |
| 70 | const std::string& json_body, std::string& error_msg) | ||
| 71 | { | ||
| 72 | 1 | return impl_->ValidateRequest(method, http_path, json_body, error_msg); | |
| 73 | } | ||
| 74 | |||
| 75 | 3 | ValidationError OASValidator::ValidateRequest(const std::string& method, const std::string& http_path, | |
| 76 | const std::unordered_map<std::string, std::string>& headers, | ||
| 77 | std::string& error_msg) | ||
| 78 | { | ||
| 79 | 3 | return impl_->ValidateRequest(method, http_path, headers, error_msg); | |
| 80 | } | ||
| 81 | |||
| 82 | 3 | ValidationError OASValidator::ValidateRequest(const std::string& method, const std::string& http_path, | |
| 83 | const std::string& json_body, | ||
| 84 | const std::unordered_map<std::string, std::string>& headers, | ||
| 85 | std::string& error_msg) | ||
| 86 | { | ||
| 87 | 3 | return impl_->ValidateRequest(method, http_path, json_body, headers, error_msg); | |
| 88 | } | ||
| 89 | |||
| 90 | 6 | OASValidator::~OASValidator() | |
| 91 | { | ||
| 92 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | delete impl_; |
| 93 | 6 | }; | |
| 94 |