mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-31 22:10:51 +00:00
[C++][Ue4] various bus fixes (#6539)
* Fixed compilation on linux and UE4.23 * Added string and enum type definition support * Better handling or variable names, should avoid conflicts with reserved keywords or empty variable names in edge cases * Updated samples
This commit is contained in:
parent
83a0f7d65b
commit
0f627e70fb
@ -497,13 +497,20 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
|||||||
name = name.toLowerCase(Locale.ROOT);
|
name = name.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Unreal variable names are CamelCase
|
||||||
|
String camelCaseName = camelize(name, false);
|
||||||
|
|
||||||
|
//Avoid empty variable name at all costs
|
||||||
|
if(!camelCaseName.isEmpty()) {
|
||||||
|
name = camelCaseName;
|
||||||
|
}
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||||
name = escapeReservedWord(name);
|
name = escapeReservedWord(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Unreal variable names are CamelCase
|
return name;
|
||||||
return camelize(name, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,5 +15,6 @@ public class {{unrealModuleName}} : ModuleRules
|
|||||||
"Json",
|
"Json",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
PCHUsage = PCHUsageMode.NoPCHs;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -52,7 +52,7 @@ public:
|
|||||||
{{#responses.0}}
|
{{#responses.0}}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
{{/responses.0}}
|
{{/responses.0}}
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
{{#returnType}}{{{returnType}}} Content;{{/returnType}}
|
{{#returnType}}{{{returnType}}} Content;{{/returnType}}
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "Serialization/JsonSerializer.h"
|
#include "Serialization/JsonSerializer.h"
|
||||||
#include "Dom/JsonObject.h"
|
#include "Dom/JsonObject.h"
|
||||||
#include "Misc/Base64.h"
|
#include "Misc/Base64.h"
|
||||||
|
#include "PlatformHttp.h"
|
||||||
|
|
||||||
class IHttpRequest;
|
class IHttpRequest;
|
||||||
|
|
||||||
@ -196,10 +197,22 @@ inline FString CollectionToUrlString_multi(const TArray<T>& Collection, const TC
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonObject>& Value)
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
|
|
||||||
{
|
{
|
||||||
Writer->WriteValue(Value);
|
if (Value.IsValid())
|
||||||
|
{
|
||||||
|
FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Writer->WriteObjectStart();
|
||||||
|
Writer->WriteObjectEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void WriteJsonValue(JsonWriter& Writer, const TArray<uint8>& Value)
|
||||||
|
{
|
||||||
|
Writer->WriteValue(ToString(Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const FDateTime& Value)
|
inline void WriteJsonValue(JsonWriter& Writer, const FDateTime& Value)
|
||||||
@ -212,6 +225,12 @@ inline void WriteJsonValue(JsonWriter& Writer, const Model& Value)
|
|||||||
Value.WriteJson(Writer);
|
Value.WriteJson(Writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||||
|
inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
|
||||||
|
{
|
||||||
|
Writer->WriteValue(Value);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<T>& Value)
|
inline void WriteJsonValue(JsonWriter& Writer, const TArray<T>& Value)
|
||||||
{
|
{
|
||||||
@ -235,54 +254,8 @@ inline void WriteJsonValue(JsonWriter& Writer, const TMap<FString, T>& Value)
|
|||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonObject>& Value)
|
|
||||||
{
|
|
||||||
if (Value.IsValid())
|
|
||||||
{
|
|
||||||
FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Writer->WriteObjectStart();
|
|
||||||
Writer->WriteObjectEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<uint8>& Value)
|
|
||||||
{
|
|
||||||
Writer->WriteValue(ToString(Value));
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, T& Value)
|
|
||||||
{
|
|
||||||
const TSharedPtr<FJsonValue> JsonValue = JsonObject->TryGetField(Key);
|
|
||||||
if (JsonValue.IsValid() && !JsonValue->IsNull())
|
|
||||||
{
|
|
||||||
return TryGetJsonValue(JsonValue, Value);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, TOptional<T>& OptionalValue)
|
|
||||||
{
|
|
||||||
if(JsonObject->HasField(Key))
|
|
||||||
{
|
|
||||||
T Value;
|
|
||||||
if (TryGetJsonValue(JsonObject, Key, Value))
|
|
||||||
{
|
|
||||||
OptionalValue = Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true; // Absence of optional value is not a parsing error
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, FString& Value)
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, FString& Value)
|
||||||
{
|
{
|
||||||
FString TmpValue;
|
FString TmpValue;
|
||||||
@ -316,6 +289,34 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, bool& Value
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TSharedPtr<FJsonObject>& JsonObjectValue)
|
||||||
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (JsonValue->TryGetObject(Object))
|
||||||
|
{
|
||||||
|
JsonObjectValue = *Object;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<uint8>& Value)
|
||||||
|
{
|
||||||
|
FString TmpValue;
|
||||||
|
if (JsonValue->TryGetString(TmpValue))
|
||||||
|
{
|
||||||
|
Base64UrlDecode(TmpValue, Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, Model& Value)
|
||||||
|
{
|
||||||
|
return Value.FromJson(JsonValue);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
||||||
{
|
{
|
||||||
@ -329,15 +330,6 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, Model& Value)
|
|
||||||
{
|
|
||||||
const TSharedPtr<FJsonObject>* Object;
|
|
||||||
if (JsonValue->TryGetObject(Object))
|
|
||||||
return Value.FromJson(*Object);
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<T>& ArrayValue)
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<T>& ArrayValue)
|
||||||
{
|
{
|
||||||
@ -377,27 +369,32 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TMap<FStrin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TSharedPtr<FJsonObject>& JsonObjectValue)
|
template<typename T>
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, T& Value)
|
||||||
{
|
{
|
||||||
const TSharedPtr<FJsonObject>* Object;
|
const TSharedPtr<FJsonValue> JsonValue = JsonObject->TryGetField(Key);
|
||||||
if (JsonValue->TryGetObject(Object))
|
if (JsonValue.IsValid() && !JsonValue->IsNull())
|
||||||
{
|
{
|
||||||
JsonObjectValue = *Object;
|
return TryGetJsonValue(JsonValue, Value);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<uint8>& Value)
|
template<typename T>
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, TOptional<T>& OptionalValue)
|
||||||
{
|
{
|
||||||
FString TmpValue;
|
if(JsonObject->HasField(Key))
|
||||||
if (JsonValue->TryGetString(TmpValue))
|
|
||||||
{
|
{
|
||||||
Base64UrlDecode(TmpValue, Value);
|
T Value;
|
||||||
return true;
|
if (TryGetJsonValue(JsonObject, Key, Value))
|
||||||
|
{
|
||||||
|
OptionalValue = Value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
return true; // Absence of optional value is not a parsing error
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#cppNamespaceDeclarations}}
|
{{#cppNamespaceDeclarations}}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "Interfaces/IHttpRequest.h"
|
#include "Interfaces/IHttpRequest.h"
|
||||||
#include "PlatformHttp.h"
|
#include "PlatformHttp.h"
|
||||||
#include "Misc/FileHelper.h"
|
#include "Misc/FileHelper.h"
|
||||||
|
#include "Misc/Paths.h"
|
||||||
|
|
||||||
{{#cppNamespaceDeclarations}}
|
{{#cppNamespaceDeclarations}}
|
||||||
namespace {{this}}
|
namespace {{this}}
|
||||||
|
@ -18,7 +18,7 @@ class {{dllapi}} Model
|
|||||||
public:
|
public:
|
||||||
virtual ~Model() {}
|
virtual ~Model() {}
|
||||||
virtual void WriteJson(JsonWriter& Writer) const = 0;
|
virtual void WriteJson(JsonWriter& Writer) const = 0;
|
||||||
virtual bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) = 0;
|
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class {{dllapi}} Request
|
class {{dllapi}} Request
|
||||||
@ -33,7 +33,7 @@ class {{dllapi}} Response
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Response() {}
|
virtual ~Response() {}
|
||||||
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) = 0;
|
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) = 0;
|
||||||
|
|
||||||
void SetSuccessful(bool InSuccessful) { Successful = InSuccessful; }
|
void SetSuccessful(bool InSuccessful) { Successful = InSuccessful; }
|
||||||
bool IsSuccessful() const { return Successful; }
|
bool IsSuccessful() const { return Successful; }
|
||||||
|
@ -21,9 +21,26 @@ class {{dllapi}} {{classname}} : public Model
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~{{classname}}() {}
|
virtual ~{{classname}}() {}
|
||||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
void WriteJson(JsonWriter& Writer) const final;
|
void WriteJson(JsonWriter& Writer) const final;
|
||||||
|
|
||||||
|
{{#isString}}
|
||||||
|
{{#isEnum}}
|
||||||
|
{{#allowableValues}}
|
||||||
|
enum class Values
|
||||||
|
{
|
||||||
|
{{#enumVars}}
|
||||||
|
{{name}},
|
||||||
|
{{/enumVars}}
|
||||||
|
};
|
||||||
|
|
||||||
|
Values Value{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};
|
||||||
|
{{/allowableValues}}
|
||||||
|
{{/isEnum}}
|
||||||
|
{{^isEnum}}
|
||||||
|
FString Value{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};
|
||||||
|
{{/isEnum}}
|
||||||
|
{{/isString}}
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#isEnum}}
|
{{#isEnum}}
|
||||||
{{#allowableValues}}
|
{{#allowableValues}}
|
||||||
|
@ -11,6 +11,54 @@ namespace {{this}}
|
|||||||
{
|
{
|
||||||
{{/cppNamespaceDeclarations}}
|
{{/cppNamespaceDeclarations}}
|
||||||
{{#models}}{{#model}}
|
{{#models}}{{#model}}
|
||||||
|
{{#isEnum}}
|
||||||
|
inline FString ToString(const {{classname}}::Values& Value)
|
||||||
|
{
|
||||||
|
{{#allowableValues}}
|
||||||
|
switch (Value)
|
||||||
|
{
|
||||||
|
{{#enumVars}}
|
||||||
|
case {{classname}}::Values::{{name}}:
|
||||||
|
return TEXT({{{value}}});
|
||||||
|
{{/enumVars}}
|
||||||
|
}
|
||||||
|
{{/allowableValues}}
|
||||||
|
|
||||||
|
UE_LOG(Log{{unrealModuleName}}, Error, TEXT("Invalid {{classname}}::Values Value (%d)"), (int)Value);
|
||||||
|
return TEXT("");
|
||||||
|
}
|
||||||
|
|
||||||
|
inline FStringFormatArg ToStringFormatArg(const {{classname}}::Values& Value)
|
||||||
|
{
|
||||||
|
return FStringFormatArg(ToString(Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void WriteJsonValue(JsonWriter& Writer, const {{classname}}::Values& Value)
|
||||||
|
{
|
||||||
|
WriteJsonValue(Writer, ToString(Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, {{classname}}::Values& Value)
|
||||||
|
{
|
||||||
|
{{#allowableValues}}
|
||||||
|
FString TmpValue;
|
||||||
|
if (JsonValue->TryGetString(TmpValue))
|
||||||
|
{
|
||||||
|
static TMap<FString, {{classname}}::Values> StringToEnum = { {{#enumVars}}
|
||||||
|
{ TEXT({{{value}}}), {{classname}}::Values::{{name}} },{{/enumVars}} };
|
||||||
|
|
||||||
|
const auto Found = StringToEnum.Find(TmpValue);
|
||||||
|
if(Found)
|
||||||
|
{
|
||||||
|
Value = *Found;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{/allowableValues}}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/isEnum}}
|
||||||
{{#hasEnums}}
|
{{#hasEnums}}
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#isEnum}}
|
{{#isEnum}}
|
||||||
@ -65,9 +113,10 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, {{classname
|
|||||||
{{/hasEnums}}
|
{{/hasEnums}}
|
||||||
void {{classname}}::WriteJson(JsonWriter& Writer) const
|
void {{classname}}::WriteJson(JsonWriter& Writer) const
|
||||||
{
|
{
|
||||||
{{#parent}}
|
{{#isString}}
|
||||||
#error inheritance not handled right now
|
WriteJsonValue(Writer, Value);
|
||||||
{{/parent}}
|
{{/isString}}
|
||||||
|
{{^isString}}
|
||||||
Writer->WriteObjectStart();
|
Writer->WriteObjectStart();
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#required}}
|
{{#required}}
|
||||||
@ -81,18 +130,29 @@ void {{classname}}::WriteJson(JsonWriter& Writer) const
|
|||||||
{{/required}}
|
{{/required}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
|
{{/isString}}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool {{classname}}::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
bool {{classname}}::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||||
{
|
{
|
||||||
|
{{#isString}}
|
||||||
|
return TryGetJsonValue(JsonValue, Value);
|
||||||
|
{{/isString}}
|
||||||
|
{{^isString}}
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (!JsonValue->TryGetObject(Object))
|
||||||
|
return false;
|
||||||
|
|
||||||
bool ParseSuccess = true;
|
bool ParseSuccess = true;
|
||||||
|
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("{{baseName}}"), {{name}});
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("{{baseName}}"), {{name}});
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
|
|
||||||
return ParseSuccess;
|
return ParseSuccess;
|
||||||
|
{{/isString}}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
||||||
{{#cppNamespaceDeclarations}}
|
{{#cppNamespaceDeclarations}}
|
||||||
|
@ -26,5 +26,6 @@ public class OpenAPI : ModuleRules
|
|||||||
"Json",
|
"Json",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
PCHUsage = PCHUsageMode.NoPCHs;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,14 +38,19 @@ void OpenAPIApiResponse::WriteJson(JsonWriter& Writer) const
|
|||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenAPIApiResponse::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
bool OpenAPIApiResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||||
{
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (!JsonValue->TryGetObject(Object))
|
||||||
|
return false;
|
||||||
|
|
||||||
bool ParseSuccess = true;
|
bool ParseSuccess = true;
|
||||||
|
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("code"), Code);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("code"), Code);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("type"), Type);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("type"), Type);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("message"), Message);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("message"), Message);
|
||||||
|
|
||||||
return ParseSuccess;
|
return ParseSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,18 @@ void OpenAPICategory::WriteJson(JsonWriter& Writer) const
|
|||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenAPICategory::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
bool OpenAPICategory::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||||
{
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (!JsonValue->TryGetObject(Object))
|
||||||
|
return false;
|
||||||
|
|
||||||
bool ParseSuccess = true;
|
bool ParseSuccess = true;
|
||||||
|
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("name"), Name);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("name"), Name);
|
||||||
|
|
||||||
return ParseSuccess;
|
return ParseSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "Interfaces/IHttpRequest.h"
|
#include "Interfaces/IHttpRequest.h"
|
||||||
#include "PlatformHttp.h"
|
#include "PlatformHttp.h"
|
||||||
#include "Misc/FileHelper.h"
|
#include "Misc/FileHelper.h"
|
||||||
|
#include "Misc/Paths.h"
|
||||||
|
|
||||||
namespace OpenAPI
|
namespace OpenAPI
|
||||||
{
|
{
|
||||||
|
@ -96,17 +96,22 @@ void OpenAPIOrder::WriteJson(JsonWriter& Writer) const
|
|||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenAPIOrder::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
bool OpenAPIOrder::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||||
{
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (!JsonValue->TryGetObject(Object))
|
||||||
|
return false;
|
||||||
|
|
||||||
bool ParseSuccess = true;
|
bool ParseSuccess = true;
|
||||||
|
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("petId"), PetId);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("petId"), PetId);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("quantity"), Quantity);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("quantity"), Quantity);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("shipDate"), ShipDate);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("shipDate"), ShipDate);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("status"), Status);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("status"), Status);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("complete"), Complete);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("complete"), Complete);
|
||||||
|
|
||||||
return ParseSuccess;
|
return ParseSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -90,17 +90,22 @@ void OpenAPIPet::WriteJson(JsonWriter& Writer) const
|
|||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenAPIPet::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
bool OpenAPIPet::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||||
{
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (!JsonValue->TryGetObject(Object))
|
||||||
|
return false;
|
||||||
|
|
||||||
bool ParseSuccess = true;
|
bool ParseSuccess = true;
|
||||||
|
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("category"), Category);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("category"), Category);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("name"), Name);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("name"), Name);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("photoUrls"), PhotoUrls);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("photoUrls"), PhotoUrls);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("tags"), Tags);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("tags"), Tags);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("status"), Status);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("status"), Status);
|
||||||
|
|
||||||
return ParseSuccess;
|
return ParseSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,18 @@ void OpenAPITag::WriteJson(JsonWriter& Writer) const
|
|||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenAPITag::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
bool OpenAPITag::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||||
{
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (!JsonValue->TryGetObject(Object))
|
||||||
|
return false;
|
||||||
|
|
||||||
bool ParseSuccess = true;
|
bool ParseSuccess = true;
|
||||||
|
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("name"), Name);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("name"), Name);
|
||||||
|
|
||||||
return ParseSuccess;
|
return ParseSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,19 +58,24 @@ void OpenAPIUser::WriteJson(JsonWriter& Writer) const
|
|||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenAPIUser::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
bool OpenAPIUser::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||||
{
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (!JsonValue->TryGetObject(Object))
|
||||||
|
return false;
|
||||||
|
|
||||||
bool ParseSuccess = true;
|
bool ParseSuccess = true;
|
||||||
|
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("username"), Username);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("username"), Username);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("firstName"), FirstName);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("firstName"), FirstName);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("lastName"), LastName);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("lastName"), LastName);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("email"), Email);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("email"), Email);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("password"), Password);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("password"), Password);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("phone"), Phone);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("phone"), Phone);
|
||||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("userStatus"), UserStatus);
|
ParseSuccess &= TryGetJsonValue(*Object, TEXT("userStatus"), UserStatus);
|
||||||
|
|
||||||
return ParseSuccess;
|
return ParseSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPIApiResponse : public Model
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~OpenAPIApiResponse() {}
|
virtual ~OpenAPIApiResponse() {}
|
||||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
void WriteJson(JsonWriter& Writer) const final;
|
void WriteJson(JsonWriter& Writer) const final;
|
||||||
|
|
||||||
TOptional<int32> Code;
|
TOptional<int32> Code;
|
||||||
|
@ -27,7 +27,7 @@ class OPENAPI_API Model
|
|||||||
public:
|
public:
|
||||||
virtual ~Model() {}
|
virtual ~Model() {}
|
||||||
virtual void WriteJson(JsonWriter& Writer) const = 0;
|
virtual void WriteJson(JsonWriter& Writer) const = 0;
|
||||||
virtual bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) = 0;
|
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OPENAPI_API Request
|
class OPENAPI_API Request
|
||||||
@ -42,7 +42,7 @@ class OPENAPI_API Response
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Response() {}
|
virtual ~Response() {}
|
||||||
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) = 0;
|
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) = 0;
|
||||||
|
|
||||||
void SetSuccessful(bool InSuccessful) { Successful = InSuccessful; }
|
void SetSuccessful(bool InSuccessful) { Successful = InSuccessful; }
|
||||||
bool IsSuccessful() const { return Successful; }
|
bool IsSuccessful() const { return Successful; }
|
||||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPICategory : public Model
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~OpenAPICategory() {}
|
virtual ~OpenAPICategory() {}
|
||||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
void WriteJson(JsonWriter& Writer) const final;
|
void WriteJson(JsonWriter& Writer) const final;
|
||||||
|
|
||||||
TOptional<int64> Id;
|
TOptional<int64> Id;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "Serialization/JsonSerializer.h"
|
#include "Serialization/JsonSerializer.h"
|
||||||
#include "Dom/JsonObject.h"
|
#include "Dom/JsonObject.h"
|
||||||
#include "Misc/Base64.h"
|
#include "Misc/Base64.h"
|
||||||
|
#include "PlatformHttp.h"
|
||||||
|
|
||||||
class IHttpRequest;
|
class IHttpRequest;
|
||||||
|
|
||||||
@ -205,10 +206,22 @@ inline FString CollectionToUrlString_multi(const TArray<T>& Collection, const TC
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonObject>& Value)
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
|
|
||||||
{
|
{
|
||||||
Writer->WriteValue(Value);
|
if (Value.IsValid())
|
||||||
|
{
|
||||||
|
FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Writer->WriteObjectStart();
|
||||||
|
Writer->WriteObjectEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void WriteJsonValue(JsonWriter& Writer, const TArray<uint8>& Value)
|
||||||
|
{
|
||||||
|
Writer->WriteValue(ToString(Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const FDateTime& Value)
|
inline void WriteJsonValue(JsonWriter& Writer, const FDateTime& Value)
|
||||||
@ -221,6 +234,12 @@ inline void WriteJsonValue(JsonWriter& Writer, const Model& Value)
|
|||||||
Value.WriteJson(Writer);
|
Value.WriteJson(Writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||||
|
inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
|
||||||
|
{
|
||||||
|
Writer->WriteValue(Value);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<T>& Value)
|
inline void WriteJsonValue(JsonWriter& Writer, const TArray<T>& Value)
|
||||||
{
|
{
|
||||||
@ -244,54 +263,8 @@ inline void WriteJsonValue(JsonWriter& Writer, const TMap<FString, T>& Value)
|
|||||||
Writer->WriteObjectEnd();
|
Writer->WriteObjectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonObject>& Value)
|
|
||||||
{
|
|
||||||
if (Value.IsValid())
|
|
||||||
{
|
|
||||||
FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Writer->WriteObjectStart();
|
|
||||||
Writer->WriteObjectEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<uint8>& Value)
|
|
||||||
{
|
|
||||||
Writer->WriteValue(ToString(Value));
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, T& Value)
|
|
||||||
{
|
|
||||||
const TSharedPtr<FJsonValue> JsonValue = JsonObject->TryGetField(Key);
|
|
||||||
if (JsonValue.IsValid() && !JsonValue->IsNull())
|
|
||||||
{
|
|
||||||
return TryGetJsonValue(JsonValue, Value);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, TOptional<T>& OptionalValue)
|
|
||||||
{
|
|
||||||
if(JsonObject->HasField(Key))
|
|
||||||
{
|
|
||||||
T Value;
|
|
||||||
if (TryGetJsonValue(JsonObject, Key, Value))
|
|
||||||
{
|
|
||||||
OptionalValue = Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true; // Absence of optional value is not a parsing error
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, FString& Value)
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, FString& Value)
|
||||||
{
|
{
|
||||||
FString TmpValue;
|
FString TmpValue;
|
||||||
@ -325,6 +298,34 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, bool& Value
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TSharedPtr<FJsonObject>& JsonObjectValue)
|
||||||
|
{
|
||||||
|
const TSharedPtr<FJsonObject>* Object;
|
||||||
|
if (JsonValue->TryGetObject(Object))
|
||||||
|
{
|
||||||
|
JsonObjectValue = *Object;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<uint8>& Value)
|
||||||
|
{
|
||||||
|
FString TmpValue;
|
||||||
|
if (JsonValue->TryGetString(TmpValue))
|
||||||
|
{
|
||||||
|
Base64UrlDecode(TmpValue, Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, Model& Value)
|
||||||
|
{
|
||||||
|
return Value.FromJson(JsonValue);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
||||||
{
|
{
|
||||||
@ -338,15 +339,6 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, Model& Value)
|
|
||||||
{
|
|
||||||
const TSharedPtr<FJsonObject>* Object;
|
|
||||||
if (JsonValue->TryGetObject(Object))
|
|
||||||
return Value.FromJson(*Object);
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<T>& ArrayValue)
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<T>& ArrayValue)
|
||||||
{
|
{
|
||||||
@ -386,27 +378,32 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TMap<FStrin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TSharedPtr<FJsonObject>& JsonObjectValue)
|
template<typename T>
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, T& Value)
|
||||||
{
|
{
|
||||||
const TSharedPtr<FJsonObject>* Object;
|
const TSharedPtr<FJsonValue> JsonValue = JsonObject->TryGetField(Key);
|
||||||
if (JsonValue->TryGetObject(Object))
|
if (JsonValue.IsValid() && !JsonValue->IsNull())
|
||||||
{
|
{
|
||||||
JsonObjectValue = *Object;
|
return TryGetJsonValue(JsonValue, Value);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<uint8>& Value)
|
template<typename T>
|
||||||
|
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, TOptional<T>& OptionalValue)
|
||||||
{
|
{
|
||||||
FString TmpValue;
|
if(JsonObject->HasField(Key))
|
||||||
if (JsonValue->TryGetString(TmpValue))
|
|
||||||
{
|
{
|
||||||
Base64UrlDecode(TmpValue, Value);
|
T Value;
|
||||||
return true;
|
if (TryGetJsonValue(JsonObject, Key, Value))
|
||||||
|
{
|
||||||
|
OptionalValue = Value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
return true; // Absence of optional value is not a parsing error
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPIOrder : public Model
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~OpenAPIOrder() {}
|
virtual ~OpenAPIOrder() {}
|
||||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
void WriteJson(JsonWriter& Writer) const final;
|
void WriteJson(JsonWriter& Writer) const final;
|
||||||
|
|
||||||
TOptional<int64> Id;
|
TOptional<int64> Id;
|
||||||
|
@ -28,7 +28,7 @@ class OPENAPI_API OpenAPIPet : public Model
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~OpenAPIPet() {}
|
virtual ~OpenAPIPet() {}
|
||||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
void WriteJson(JsonWriter& Writer) const final;
|
void WriteJson(JsonWriter& Writer) const final;
|
||||||
|
|
||||||
TOptional<int64> Id;
|
TOptional<int64> Id;
|
||||||
|
@ -41,7 +41,7 @@ class OPENAPI_API OpenAPIPetApi::AddPetResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~AddPetResponse() {}
|
virtual ~AddPetResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -66,7 +66,7 @@ class OPENAPI_API OpenAPIPetApi::DeletePetResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~DeletePetResponse() {}
|
virtual ~DeletePetResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -97,7 +97,7 @@ class OPENAPI_API OpenAPIPetApi::FindPetsByStatusResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~FindPetsByStatusResponse() {}
|
virtual ~FindPetsByStatusResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
TArray<OpenAPIPet> Content;
|
TArray<OpenAPIPet> Content;
|
||||||
};
|
};
|
||||||
@ -122,7 +122,7 @@ class OPENAPI_API OpenAPIPetApi::FindPetsByTagsResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~FindPetsByTagsResponse() {}
|
virtual ~FindPetsByTagsResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
TArray<OpenAPIPet> Content;
|
TArray<OpenAPIPet> Content;
|
||||||
};
|
};
|
||||||
@ -147,7 +147,7 @@ class OPENAPI_API OpenAPIPetApi::GetPetByIdResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~GetPetByIdResponse() {}
|
virtual ~GetPetByIdResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
OpenAPIPet Content;
|
OpenAPIPet Content;
|
||||||
};
|
};
|
||||||
@ -171,7 +171,7 @@ class OPENAPI_API OpenAPIPetApi::UpdatePetResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~UpdatePetResponse() {}
|
virtual ~UpdatePetResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -199,7 +199,7 @@ class OPENAPI_API OpenAPIPetApi::UpdatePetWithFormResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~UpdatePetWithFormResponse() {}
|
virtual ~UpdatePetWithFormResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -227,7 +227,7 @@ class OPENAPI_API OpenAPIPetApi::UploadFileResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~UploadFileResponse() {}
|
virtual ~UploadFileResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
OpenAPIApiResponse Content;
|
OpenAPIApiResponse Content;
|
||||||
};
|
};
|
||||||
|
@ -40,7 +40,7 @@ class OPENAPI_API OpenAPIStoreApi::DeleteOrderResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~DeleteOrderResponse() {}
|
virtual ~DeleteOrderResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -63,7 +63,7 @@ class OPENAPI_API OpenAPIStoreApi::GetInventoryResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~GetInventoryResponse() {}
|
virtual ~GetInventoryResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
TMap<FString, int32> Content;
|
TMap<FString, int32> Content;
|
||||||
};
|
};
|
||||||
@ -88,7 +88,7 @@ class OPENAPI_API OpenAPIStoreApi::GetOrderByIdResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~GetOrderByIdResponse() {}
|
virtual ~GetOrderByIdResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
OpenAPIOrder Content;
|
OpenAPIOrder Content;
|
||||||
};
|
};
|
||||||
@ -112,7 +112,7 @@ class OPENAPI_API OpenAPIStoreApi::PlaceOrderResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~PlaceOrderResponse() {}
|
virtual ~PlaceOrderResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
OpenAPIOrder Content;
|
OpenAPIOrder Content;
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPITag : public Model
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~OpenAPITag() {}
|
virtual ~OpenAPITag() {}
|
||||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
void WriteJson(JsonWriter& Writer) const final;
|
void WriteJson(JsonWriter& Writer) const final;
|
||||||
|
|
||||||
TOptional<int64> Id;
|
TOptional<int64> Id;
|
||||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPIUser : public Model
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~OpenAPIUser() {}
|
virtual ~OpenAPIUser() {}
|
||||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
void WriteJson(JsonWriter& Writer) const final;
|
void WriteJson(JsonWriter& Writer) const final;
|
||||||
|
|
||||||
TOptional<int64> Id;
|
TOptional<int64> Id;
|
||||||
|
@ -40,7 +40,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUserResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~CreateUserResponse() {}
|
virtual ~CreateUserResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -64,7 +64,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUsersWithArrayInputResponse : public Res
|
|||||||
public:
|
public:
|
||||||
virtual ~CreateUsersWithArrayInputResponse() {}
|
virtual ~CreateUsersWithArrayInputResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -88,7 +88,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUsersWithListInputResponse : public Resp
|
|||||||
public:
|
public:
|
||||||
virtual ~CreateUsersWithListInputResponse() {}
|
virtual ~CreateUsersWithListInputResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -113,7 +113,7 @@ class OPENAPI_API OpenAPIUserApi::DeleteUserResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~DeleteUserResponse() {}
|
virtual ~DeleteUserResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -137,7 +137,7 @@ class OPENAPI_API OpenAPIUserApi::GetUserByNameResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~GetUserByNameResponse() {}
|
virtual ~GetUserByNameResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
OpenAPIUser Content;
|
OpenAPIUser Content;
|
||||||
};
|
};
|
||||||
@ -163,7 +163,7 @@ class OPENAPI_API OpenAPIUserApi::LoginUserResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~LoginUserResponse() {}
|
virtual ~LoginUserResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
FString Content;
|
FString Content;
|
||||||
};
|
};
|
||||||
@ -185,7 +185,7 @@ class OPENAPI_API OpenAPIUserApi::LogoutUserResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~LogoutUserResponse() {}
|
virtual ~LogoutUserResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -212,7 +212,7 @@ class OPENAPI_API OpenAPIUserApi::UpdateUserResponse : public Response
|
|||||||
public:
|
public:
|
||||||
virtual ~UpdateUserResponse() {}
|
virtual ~UpdateUserResponse() {}
|
||||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user