keyjh2 be94c22d08
[C++][Pistache] Compile error when nesting references (#16711) (#18586)
When components/schema/<object> reference other objects, validate() was
getting called on the referenced objects with no arguments. The return
value was void, but checked as if it was a boolean value.
2024-05-07 17:15:42 +08:00

78 lines
2.2 KiB
C++

/**
* Test swagger file
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* StoreApi.h
*
*
*/
#ifndef StoreApi_H_
#define StoreApi_H_
#include "ApiBase.h"
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <optional>
#include <utility>
#include "OuterType.h"
namespace org::openapitools::server::api
{
class StoreApi : public ApiBase {
public:
explicit StoreApi(const std::shared_ptr<Pistache::Rest::Router>& rtr);
~StoreApi() override = default;
void init() override;
static const std::string base;
private:
void setupRoutes();
void get_nested_object_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void store_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
/// <summary>
/// Helper function to handle unexpected Exceptions during Parameter parsing and validation.
/// May be overridden 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 overridden 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;
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
virtual void get_nested_object(Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace org::openapitools::server::api
#endif /* StoreApi_H_ */