[cpp-restsdk] add support for AnyType (#18463)

* [cpp-restsdk] add support for AnyType

* [cpp-restsdk] fix the AnyType header generation path
This commit is contained in:
Amin Yahyaabadi
2024-04-23 22:44:21 -07:00
committed by GitHub
parent dc96d648f7
commit 7036b99e91
8 changed files with 211 additions and 1 deletions

View File

@@ -1,8 +1,10 @@
.gitignore
.openapi-generator-ignore
CMakeLists.txt
Config.cmake.in
README.md
git_push.sh
include/CppRestPetstoreClient/AnyType.h
include/CppRestPetstoreClient/ApiClient.h
include/CppRestPetstoreClient/ApiConfiguration.h
include/CppRestPetstoreClient/ApiException.h
@@ -21,6 +23,7 @@ include/CppRestPetstoreClient/model/Order.h
include/CppRestPetstoreClient/model/Pet.h
include/CppRestPetstoreClient/model/Tag.h
include/CppRestPetstoreClient/model/User.h
src/AnyType.cpp
src/ApiClient.cpp
src/ApiConfiguration.cpp
src/ApiException.cpp

View File

@@ -0,0 +1,58 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AnyType.h
*
* This is the implementation of an any JSON type.
*/
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_AnyType_H_
#define ORG_OPENAPITOOLS_CLIENT_MODEL_AnyType_H_
#include "CppRestPetstoreClient/Object.h"
#include <cpprest/details/basic_types.h>
#include <cpprest/json.h>
namespace org {
namespace openapitools {
namespace client {
namespace model {
class AnyType : public Object {
public:
AnyType();
virtual ~AnyType();
/////////////////////////////////////////////
/// ModelBase overrides
void validate() override;
web::json::value toJson() const override;
bool fromJson(const web::json::value &json) override;
void toMultipart(std::shared_ptr<MultipartFormData> multipart,
const utility::string_t &namePrefix) const override;
bool fromMultiPart(std::shared_ptr<MultipartFormData> multipart,
const utility::string_t &namePrefix) override;
private:
web::json::value m_value;
};
}
}
}
}
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_AnyType_H_ */

View File

@@ -0,0 +1,52 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "CppRestPetstoreClient/AnyType.h"
namespace org {
namespace openapitools {
namespace client {
namespace model {
AnyType::AnyType() { m_value = web::json::value::null(); }
AnyType::~AnyType() {}
void AnyType::validate() {}
web::json::value AnyType::toJson() const { return m_value; }
bool AnyType::fromJson(const web::json::value &val) {
m_value = val;
m_IsSet = true;
return isSet();
}
void AnyType::toMultipart(std::shared_ptr<MultipartFormData> multipart,
const utility::string_t &prefix) const {
if (m_value.is_object()) {
return Object::toMultipart(multipart, prefix);
}
throw std::runtime_error("AnyType::toMultipart: unsupported type");
}
bool AnyType::fromMultiPart(std::shared_ptr<MultipartFormData> multipart,
const utility::string_t &prefix) {
if (m_value.is_object()) {
return Object::fromMultiPart(multipart, prefix);
}
return false;
}
}
}
}
}