Samuel Kahn e3eb3c2f7d
UE4 client generator fixes (#6438)
* Added the possibility for a codegen to set the location of the generated model files, similarly to API files.

* Removed std::shared_ptr from the generated types. Types in UE4Codegen are handled as POD structs, not shared pointers.

* Fixed handling of body parameters as per the specification, the single body object is written directly as the payload.

* Fixed handling of files and binaries, if a field is both isFile and isBinary, file will take precedence.

* Updated cpp-ue4 client samples

* Fixed handling of enums in models

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-06-01 00:13:12 +08:00

52 lines
1.3 KiB
C++

/**
* 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.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* https://github.com/OpenAPITools/openapi-generator
* Do not edit the class manually.
*/
#include "OpenAPIApiResponse.h"
#include "OpenAPIModule.h"
#include "OpenAPIHelpers.h"
#include "Templates/SharedPointer.h"
namespace OpenAPI
{
void OpenAPIApiResponse::WriteJson(JsonWriter& Writer) const
{
Writer->WriteObjectStart();
if (Code.IsSet())
{
Writer->WriteIdentifierPrefix(TEXT("code")); WriteJsonValue(Writer, Code.GetValue());
}
if (Type.IsSet())
{
Writer->WriteIdentifierPrefix(TEXT("type")); WriteJsonValue(Writer, Type.GetValue());
}
if (Message.IsSet())
{
Writer->WriteIdentifierPrefix(TEXT("message")); WriteJsonValue(Writer, Message.GetValue());
}
Writer->WriteObjectEnd();
}
bool OpenAPIApiResponse::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
{
bool ParseSuccess = true;
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("code"), Code);
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("type"), Type);
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("message"), Message);
return ParseSuccess;
}
}