diff --git a/samples/client/petstore/cpp-ue4/OpenAPI.Build.cs b/samples/client/petstore/cpp-ue4/OpenAPI.Build.cs index f6d2f83eba8..bb8262b7433 100644 --- a/samples/client/petstore/cpp-ue4/OpenAPI.Build.cs +++ b/samples/client/petstore/cpp-ue4/OpenAPI.Build.cs @@ -22,7 +22,7 @@ public class OpenAPI : ModuleRules new string[] { "Core", - "Http", + "HTTP", "Json", } ); diff --git a/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApiOperations.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApiOperations.cpp index 4708d2e8468..5e19551bda8 100644 --- a/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApiOperations.cpp +++ b/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApiOperations.cpp @@ -382,7 +382,7 @@ void OpenAPIPetApi::UpdatePetWithFormRequest::SetupHttpRequest(const FHttpReques // Default to Json Body request if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json"))) { - // Form parameters + // Form parameters added to try to generate a json body when no body parameters are specified. FString JsonBody; JsonWriter Writer = TJsonWriterFactory<>::Create(&JsonBody); Writer->WriteObjectStart(); @@ -470,7 +470,7 @@ void OpenAPIPetApi::UploadFileRequest::SetupHttpRequest(const FHttpRequestRef& H // Default to Json Body request if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json"))) { - // Form parameters + // Form parameters added to try to generate a json body when no body parameters are specified. FString JsonBody; JsonWriter Writer = TJsonWriterFactory<>::Create(&JsonBody); Writer->WriteObjectStart(); @@ -478,10 +478,7 @@ void OpenAPIPetApi::UploadFileRequest::SetupHttpRequest(const FHttpRequestRef& H Writer->WriteIdentifierPrefix(TEXT("additionalMetadata")); WriteJsonValue(Writer, AdditionalMetadata.GetValue()); } - if (File.IsSet()){ - Writer->WriteIdentifierPrefix(TEXT("file")); - WriteJsonValue(Writer, File.GetValue()); - } + UE_LOG(LogOpenAPI, Error, TEXT("Form parameter (file) was ignored, Files are not supported in json body")); Writer->WriteObjectEnd(); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); diff --git a/samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h index ff8497f23f9..799e218f281 100644 --- a/samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h +++ b/samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h @@ -103,12 +103,18 @@ FString Base64UrlEncode(const T& Value) return Base64String; } -template +template::value, int>::type = 0> inline FStringFormatArg ToStringFormatArg(const T& Value) { return FStringFormatArg(Value); } +template::value, int>::type = 0> +inline FStringFormatArg ToStringFormatArg(const T& EnumModelValue) +{ + return FStringFormatArg(T::EnumToString(EnumModelValue.Value)); +} + inline FStringFormatArg ToStringFormatArg(const FDateTime& Value) { return FStringFormatArg(Value.ToIso8601());