Merge remote-tracking branch 'origin/5.3.x' into 6.0.x

This commit is contained in:
William Cheng
2021-07-12 17:11:35 +08:00
3874 changed files with 120282 additions and 21640 deletions

View File

@@ -1 +1,5 @@
6.0.0-SNAPSHOT
<<<<<<< HEAD
6.0.0-SNAPSHOT
=======
5.3.0-SNAPSHOT
>>>>>>> origin/5.3.x

View File

@@ -49,11 +49,13 @@ void PetApi::setupRoutes() {
std::pair<Pistache::Http::Code, std::string> PetApi::handleParsingException(const std::exception& ex) const noexcept
{
try {
throw ex;
throw;
} catch (nlohmann::detail::exception &e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (org::openapitools::server::helpers::ValidationException &e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (std::exception &e) {
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what())
}
}

View File

@@ -58,13 +58,15 @@ private:
/// <summary>
/// Helper function to handle unexpected Exceptions during Parameter parsing and validation.
/// May be overriden to return custom error formats.
/// May be overriden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleParsingException(const std::exception& ex) const noexcept;
/// <summary>
/// Helper function to handle unexpected Exceptions during processing of the request in handler functions.
/// May be overriden to return custom error formats.
/// May be overriden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleOperationException(const std::exception& ex) const noexcept;

View File

@@ -45,11 +45,13 @@ void StoreApi::setupRoutes() {
std::pair<Pistache::Http::Code, std::string> StoreApi::handleParsingException(const std::exception& ex) const noexcept
{
try {
throw ex;
throw;
} catch (nlohmann::detail::exception &e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (org::openapitools::server::helpers::ValidationException &e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (std::exception &e) {
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what())
}
}

View File

@@ -54,13 +54,15 @@ private:
/// <summary>
/// Helper function to handle unexpected Exceptions during Parameter parsing and validation.
/// May be overriden to return custom error formats.
/// May be overriden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleParsingException(const std::exception& ex) const noexcept;
/// <summary>
/// Helper function to handle unexpected Exceptions during processing of the request in handler functions.
/// May be overriden to return custom error formats.
/// May be overriden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleOperationException(const std::exception& ex) const noexcept;

View File

@@ -49,11 +49,13 @@ void UserApi::setupRoutes() {
std::pair<Pistache::Http::Code, std::string> UserApi::handleParsingException(const std::exception& ex) const noexcept
{
try {
throw ex;
throw;
} catch (nlohmann::detail::exception &e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (org::openapitools::server::helpers::ValidationException &e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (std::exception &e) {
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what())
}
}

View File

@@ -58,13 +58,15 @@ private:
/// <summary>
/// Helper function to handle unexpected Exceptions during Parameter parsing and validation.
/// May be overriden to return custom error formats.
/// May be overriden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleParsingException(const std::exception& ex) const noexcept;
/// <summary>
/// Helper function to handle unexpected Exceptions during processing of the request in handler functions.
/// May be overriden to return custom error formats.
/// May be overriden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleOperationException(const std::exception& ex) const noexcept;

View File

@@ -49,10 +49,7 @@ bool ApiResponse::validate(std::stringstream& msg, const std::string& pathPrefix
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "ApiResponse" : pathPrefix;
return success;
}

View File

@@ -46,6 +46,12 @@ public:
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const ApiResponse& rhs) const;
bool operator!=(const ApiResponse& rhs) const;
@@ -83,9 +89,7 @@ protected:
bool m_TypeIsSet;
std::string m_Message;
bool m_MessageIsSet;
// Helper overload for validate. Used when one model stores another model and calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
};
} // namespace org::openapitools::server::model

View File

@@ -47,9 +47,7 @@ bool Category::validate(std::stringstream& msg, const std::string& pathPrefix) c
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Category" : pathPrefix;
return success;
}

View File

@@ -46,6 +46,12 @@ public:
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Category& rhs) const;
bool operator!=(const Category& rhs) const;
@@ -74,9 +80,7 @@ protected:
bool m_IdIsSet;
std::string m_Name;
bool m_NameIsSet;
// Helper overload for validate. Used when one model stores another model and calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
};
} // namespace org::openapitools::server::model

View File

@@ -55,13 +55,7 @@ bool Order::validate(std::stringstream& msg, const std::string& pathPrefix) cons
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Order" : pathPrefix;
return success;
}

View File

@@ -46,6 +46,12 @@ public:
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Order& rhs) const;
bool operator!=(const Order& rhs) const;
@@ -110,9 +116,7 @@ protected:
bool m_StatusIsSet;
bool m_Complete;
bool m_CompleteIsSet;
// Helper overload for validate. Used when one model stores another model and calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
};
} // namespace org::openapitools::server::model

View File

@@ -50,10 +50,7 @@ bool Pet::validate(std::stringstream& msg, const std::string& pathPrefix) const
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Pet" : pathPrefix;
/* PhotoUrls */ {
const std::vector<std::string>& value = m_PhotoUrls;
@@ -74,8 +71,7 @@ bool Pet::validate(std::stringstream& msg, const std::string& pathPrefix) const
}
}
if (tagsIsSet())
{
const std::vector<Tag>& value = m_Tags;
@@ -96,9 +92,7 @@ bool Pet::validate(std::stringstream& msg, const std::string& pathPrefix) const
}
}
return success;
}

View File

@@ -49,6 +49,12 @@ public:
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Pet& rhs) const;
bool operator!=(const Pet& rhs) const;
@@ -109,9 +115,7 @@ protected:
bool m_TagsIsSet;
std::string m_Status;
bool m_StatusIsSet;
// Helper overload for validate. Used when one model stores another model and calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
};
} // namespace org::openapitools::server::model

View File

@@ -47,9 +47,7 @@ bool Tag::validate(std::stringstream& msg, const std::string& pathPrefix) const
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Tag" : pathPrefix;
return success;
}

View File

@@ -46,6 +46,12 @@ public:
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Tag& rhs) const;
bool operator!=(const Tag& rhs) const;
@@ -74,9 +80,7 @@ protected:
bool m_IdIsSet;
std::string m_Name;
bool m_NameIsSet;
// Helper overload for validate. Used when one model stores another model and calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
};
} // namespace org::openapitools::server::model

View File

@@ -59,15 +59,7 @@ bool User::validate(std::stringstream& msg, const std::string& pathPrefix) const
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "User" : pathPrefix;
return success;
}

View File

@@ -46,6 +46,12 @@ public:
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const User& rhs) const;
bool operator!=(const User& rhs) const;
@@ -128,9 +134,7 @@ protected:
bool m_PhoneIsSet;
int32_t m_UserStatus;
bool m_UserStatusIsSet;
// Helper overload for validate. Used when one model stores another model and calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
};
} // namespace org::openapitools::server::model