queryParams, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php
index c590d545773..5f2eb0eff73 100644
--- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php
+++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php
@@ -277,7 +277,7 @@ protected function testCodeInjectEndRnNRRequest($test_code_inject____end____rn_n
} else {
// for HTTP post (form)
- $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
+ $httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
}
}
@@ -293,7 +293,7 @@ protected function testCodeInjectEndRnNRRequest($test_code_inject____end____rn_n
$headers
);
- $query = \GuzzleHttp\Psr7\build_query($queryParams);
+ $query = \GuzzleHttp\Psr7\Query::build($queryParams);
return new Request(
'PUT',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
diff --git a/samples/client/petstore-security-test/ruby/Gemfile b/samples/client/petstore-security-test/ruby/Gemfile
index d255a3ab238..f58bec06367 100644
--- a/samples/client/petstore-security-test/ruby/Gemfile
+++ b/samples/client/petstore-security-test/ruby/Gemfile
@@ -3,5 +3,5 @@ source 'https://rubygems.org'
gemspec
group :development, :test do
- gem 'rake', '~> 12.0.0'
+ gem 'rake', '~> 12.3.3'
end
diff --git a/samples/client/petstore-security-test/ruby/lib/petstore/models/model_return.rb b/samples/client/petstore-security-test/ruby/lib/petstore/models/model_return.rb
index 9e6ffd465a7..99d2d2eab1a 100644
--- a/samples/client/petstore-security-test/ruby/lib/petstore/models/model_return.rb
+++ b/samples/client/petstore-security-test/ruby/lib/petstore/models/model_return.rb
@@ -87,7 +87,7 @@ def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
- # check to ensure the input is an array given that the the attribute
+ # check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
diff --git a/samples/client/petstore-security-test/scala/pom.xml b/samples/client/petstore-security-test/scala/pom.xml
index dc83c236251..934e163b5a5 100644
--- a/samples/client/petstore-security-test/scala/pom.xml
+++ b/samples/client/petstore-security-test/scala/pom.xml
@@ -240,12 +240,12 @@
1.9.2
2.9.9
1.19.4
- 1.5.18
+ 1.5.24
1.0.5
1.0.0
2.9.2
- 4.12
+ 4.13.1
3.1.5
3.0.4
0.3.5
diff --git a/samples/client/petstore/java/jersey2-java6/.swagger-codegen-ignore b/samples/client/petstore-security-test/ue4cpp/.swagger-codegen-ignore
similarity index 100%
rename from samples/client/petstore/java/jersey2-java6/.swagger-codegen-ignore
rename to samples/client/petstore-security-test/ue4cpp/.swagger-codegen-ignore
diff --git a/samples/client/petstore-security-test/ue4cpp/.swagger-codegen/VERSION b/samples/client/petstore-security-test/ue4cpp/.swagger-codegen/VERSION
new file mode 100644
index 00000000000..4b308f2ac9e
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/.swagger-codegen/VERSION
@@ -0,0 +1 @@
+2.4.15-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore-security-test/ue4cpp/Private/SwaggerBaseModel.cpp b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerBaseModel.cpp
new file mode 100644
index 00000000000..0b0b87f1451
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerBaseModel.cpp
@@ -0,0 +1,27 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#include "SwaggerBaseModel.h"
+
+namespace Swagger
+{
+
+void Response::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
+{
+ ResponseCode = InHttpResponseCode;
+ SetSuccessful(EHttpResponseCodes::IsOk(InHttpResponseCode));
+ if(InHttpResponseCode == EHttpResponseCodes::RequestTimeout)
+ {
+ SetResponseString(TEXT("Request Timeout"));
+ }
+}
+
+}
diff --git a/samples/client/petstore-security-test/ue4cpp/Private/SwaggerFakeApi.cpp b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerFakeApi.cpp
new file mode 100644
index 00000000000..f1c6cb67026
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerFakeApi.cpp
@@ -0,0 +1,122 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#include "SwaggerFakeApi.h"
+
+#include "SwaggerFakeApiOperations.h"
+#include "SwaggerModule.h"
+
+#include "HttpModule.h"
+#include "Serialization/JsonSerializer.h"
+
+namespace Swagger
+{
+
+SwaggerFakeApi::SwaggerFakeApi()
+: Url(TEXT("https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r"))
+{
+}
+
+SwaggerFakeApi::~SwaggerFakeApi() {}
+
+void SwaggerFakeApi::SetURL(const FString& InUrl)
+{
+ Url = InUrl;
+}
+
+void SwaggerFakeApi::AddHeaderParam(const FString& Key, const FString& Value)
+{
+ AdditionalHeaderParams.Add(Key, Value);
+}
+
+void SwaggerFakeApi::ClearHeaderParams()
+{
+ AdditionalHeaderParams.Reset();
+}
+
+bool SwaggerFakeApi::IsValid() const
+{
+ if (Url.IsEmpty())
+ {
+ UE_LOG(LogSwagger, Error, TEXT("SwaggerFakeApi: Endpoint Url is not set, request cannot be performed"));
+ return false;
+ }
+
+ return true;
+}
+
+void SwaggerFakeApi::HandleResponse(FHttpResponsePtr HttpResponse, bool bSucceeded, Response& InOutResponse) const
+{
+ InOutResponse.SetHttpResponse(HttpResponse);
+ InOutResponse.SetSuccessful(bSucceeded);
+
+ if (bSucceeded && HttpResponse.IsValid())
+ {
+ InOutResponse.SetHttpResponseCode((EHttpResponseCodes::Type)HttpResponse->GetResponseCode());
+ FString ContentType = HttpResponse->GetContentType();
+ FString Content;
+
+ if (ContentType == TEXT("application/json"))
+ {
+ Content = HttpResponse->GetContentAsString();
+
+ TSharedPtr JsonValue;
+ auto Reader = TJsonReaderFactory<>::Create(Content);
+
+ if (FJsonSerializer::Deserialize(Reader, JsonValue) && JsonValue.IsValid())
+ {
+ if (InOutResponse.FromJson(JsonValue))
+ return; // Successfully parsed
+ }
+ }
+ else if(ContentType == TEXT("text/plain"))
+ {
+ Content = HttpResponse->GetContentAsString();
+ InOutResponse.SetResponseString(Content);
+ return; // Successfully parsed
+ }
+
+ // Report the parse error but do not mark the request as unsuccessful. Data could be partial or malformed, but the request succeeded.
+ UE_LOG(LogSwagger, Error, TEXT("Failed to deserialize Http response content (type:%s):\n%s"), *ContentType , *Content);
+ return;
+ }
+
+ // By default, assume we failed to establish connection
+ InOutResponse.SetHttpResponseCode(EHttpResponseCodes::RequestTimeout);
+}
+
+bool SwaggerFakeApi::TestCodeInjectEndRnNR(const TestCodeInjectEndRnNRRequest& Request, const FTestCodeInjectEndRnNRDelegate& Delegate /*= FTestCodeInjectEndRnNRDelegate()*/) const
+{
+ if (!IsValid())
+ return false;
+
+ TSharedRef HttpRequest = FHttpModule::Get().CreateRequest();
+ HttpRequest->SetURL(*(Url + Request.ComputePath()));
+
+ for(const auto& It : AdditionalHeaderParams)
+ {
+ HttpRequest->SetHeader(It.Key, It.Value);
+ }
+
+ Request.SetupHttpRequest(HttpRequest);
+
+ HttpRequest->OnProcessRequestComplete().BindRaw(this, &SwaggerFakeApi::OnTestCodeInjectEndRnNRResponse, Delegate);
+ return HttpRequest->ProcessRequest();
+}
+
+void SwaggerFakeApi::OnTestCodeInjectEndRnNRResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FTestCodeInjectEndRnNRDelegate Delegate) const
+{
+ TestCodeInjectEndRnNRResponse Response;
+ HandleResponse(HttpResponse, bSucceeded, Response);
+ Delegate.ExecuteIfBound(Response);
+}
+
+}
diff --git a/samples/client/petstore-security-test/ue4cpp/Private/SwaggerFakeApiOperations.cpp b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerFakeApiOperations.cpp
new file mode 100644
index 00000000000..358905aa261
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerFakeApiOperations.cpp
@@ -0,0 +1,86 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#include "SwaggerFakeApiOperations.h"
+
+#include "SwaggerModule.h"
+#include "SwaggerHelpers.h"
+
+#include "Dom/JsonObject.h"
+#include "Templates/SharedPointer.h"
+#include "HttpModule.h"
+#include "PlatformHttp.h"
+
+namespace Swagger
+{
+
+FString SwaggerFakeApi::TestCodeInjectEndRnNRRequest::ComputePath() const
+{
+ FString Path(TEXT("/fake"));
+ return Path;
+}
+
+void SwaggerFakeApi::TestCodeInjectEndRnNRRequest::SetupHttpRequest(const TSharedRef& HttpRequest) const
+{
+ static const TArray Consumes = { TEXT("application/json"), TEXT("*_/ ' =end -- ") };
+ //static const TArray Produces = { TEXT("application/json"), TEXT("*_/ ' =end -- ") };
+
+ HttpRequest->SetVerb(TEXT("PUT"));
+
+ // Default to Json Body request
+ if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
+ {
+ UE_LOG(LogSwagger, Error, TEXT("Form parameter (test code inject */ ' " =end -- \r\n \n \r) was ignored, cannot be used in JsonBody"));
+ }
+ else if (Consumes.Contains(TEXT("multipart/form-data")))
+ {
+ HttpMultipartFormData FormData;
+ if(TestCodeInjectEndRnNR.IsSet())
+ {
+ FormData.AddStringPart(TEXT("test code inject */ ' " =end -- \r\n \n \r"), *ToUrlString(TestCodeInjectEndRnNR.GetValue()));
+ }
+
+ FormData.SetupHttpRequest(HttpRequest);
+ }
+ else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
+ {
+ TArray FormParams;
+ if(TestCodeInjectEndRnNR.IsSet())
+ {
+ FormParams.Add(FString(TEXT("test code inject */ ' " =end -- \r\n \n \r=")) + ToUrlString(TestCodeInjectEndRnNR.GetValue()));
+ }
+
+ HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/x-www-form-urlencoded; charset=utf-8"));
+ HttpRequest->SetContentAsString(FString::Join(FormParams, TEXT("&")));
+ }
+ else
+ {
+ UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
+ }
+}
+
+void SwaggerFakeApi::TestCodeInjectEndRnNRResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
+{
+ Response::SetHttpResponseCode(InHttpResponseCode);
+ switch ((int)InHttpResponseCode)
+ {
+ case 400:
+ SetResponseString(TEXT("To test code injection *_/ ' \" =end -- \\r\\n \\n \\r"));
+ break;
+ }
+}
+
+bool SwaggerFakeApi::TestCodeInjectEndRnNRResponse::FromJson(const TSharedPtr& JsonValue)
+{
+ return true;
+}
+
+}
diff --git a/samples/client/petstore-security-test/ue4cpp/Private/SwaggerHelpers.cpp b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerHelpers.cpp
new file mode 100644
index 00000000000..2592615083a
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerHelpers.cpp
@@ -0,0 +1,193 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#include "SwaggerHelpers.h"
+
+#include "SwaggerModule.h"
+
+#include "Interfaces/IHttpRequest.h"
+#include "PlatformHttp.h"
+#include "Misc/FileHelper.h"
+
+namespace Swagger
+{
+
+HttpFileInput::HttpFileInput(const TCHAR* InFilePath)
+{
+ SetFilePath(InFilePath);
+}
+
+HttpFileInput::HttpFileInput(const FString& InFilePath)
+{
+ SetFilePath(InFilePath);
+}
+
+void HttpFileInput::SetFilePath(const TCHAR* InFilePath)
+{
+ FilePath = InFilePath;
+ if(ContentType.IsEmpty())
+ {
+ ContentType = FPlatformHttp::GetMimeType(InFilePath);
+ }
+}
+
+void HttpFileInput::SetFilePath(const FString& InFilePath)
+{
+ SetFilePath(*InFilePath);
+}
+
+void HttpFileInput::SetContentType(const TCHAR* InContentType)
+{
+ ContentType = InContentType;
+}
+
+FString HttpFileInput::GetFilename() const
+{
+ return FPaths::GetCleanFilename(FilePath);
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+const TCHAR* HttpMultipartFormData::Delimiter = TEXT("--");
+const TCHAR* HttpMultipartFormData::Newline = TEXT("\r\n");
+
+void HttpMultipartFormData::SetBoundary(const TCHAR* InBoundary)
+{
+ checkf(Boundary.IsEmpty(), TEXT("Boundary must be set before usage"));
+ Boundary = InBoundary;
+}
+
+const FString& HttpMultipartFormData::GetBoundary() const
+{
+ if (Boundary.IsEmpty())
+ {
+ // Generate a random boundary with enough entropy, should avoid occurences of the boundary in the data.
+ // Since the boundary is generated at every request, in case of failure, retries should succeed.
+ Boundary = FGuid::NewGuid().ToString(EGuidFormats::Short);
+ }
+
+ return Boundary;
+}
+
+void HttpMultipartFormData::SetupHttpRequest(const TSharedRef& HttpRequest)
+{
+ if(HttpRequest->GetVerb() != TEXT("POST"))
+ {
+ UE_LOG(LogSwagger, Error, TEXT("Expected POST verb when using multipart form data"));
+ }
+
+ // Append final boundary
+ AppendString(Delimiter);
+ AppendString(*GetBoundary());
+ AppendString(Delimiter);
+
+ HttpRequest->SetHeader("Content-Type", FString::Printf(TEXT("multipart/form-data; boundary=%s"), *GetBoundary()));
+ HttpRequest->SetContent(FormData);
+}
+
+void HttpMultipartFormData::AddStringPart(const TCHAR* Name, const TCHAR* Data)
+{
+ // Add boundary
+ AppendString(Delimiter);
+ AppendString(*GetBoundary());
+ AppendString(Newline);
+
+ // Add header
+ AppendString(*FString::Printf(TEXT("Content-Disposition: form-data; name = \"%s\""), Name));
+ AppendString(Newline);
+ AppendString(*FString::Printf(TEXT("Content-Type: text/plain; charset=utf-8")));
+ AppendString(Newline);
+
+ // Add header to body splitter
+ AppendString(Newline);
+
+ // Add Data
+ AppendString(Data);
+ AppendString(Newline);
+}
+
+void HttpMultipartFormData::AddJsonPart(const TCHAR* Name, const FString& JsonString)
+{
+ // Add boundary
+ AppendString(Delimiter);
+ AppendString(*GetBoundary());
+ AppendString(Newline);
+
+ // Add header
+ AppendString(*FString::Printf(TEXT("Content-Disposition: form-data; name=\"%s\""), Name));
+ AppendString(Newline);
+ AppendString(*FString::Printf(TEXT("Content-Type: application/json; charset=utf-8")));
+ AppendString(Newline);
+
+ // Add header to body splitter
+ AppendString(Newline);
+
+ // Add Data
+ AppendString(*JsonString);
+ AppendString(Newline);
+}
+
+void HttpMultipartFormData::AddBinaryPart(const TCHAR* Name, const TArray& ByteArray)
+{
+ // Add boundary
+ AppendString(Delimiter);
+ AppendString(*GetBoundary());
+ AppendString(Newline);
+
+ // Add header
+ AppendString(*FString::Printf(TEXT("Content-Disposition: form-data; name=\"%s\""), Name));
+ AppendString(Newline);
+ AppendString(*FString::Printf(TEXT("Content-Type: application/octet-stream")));
+ AppendString(Newline);
+
+ // Add header to body splitter
+ AppendString(Newline);
+
+ // Add Data
+ FormData.Append(ByteArray);
+ AppendString(Newline);
+}
+
+void HttpMultipartFormData::AddFilePart(const TCHAR* Name, const HttpFileInput& File)
+{
+ TArray FileContents;
+ if (!FFileHelper::LoadFileToArray(FileContents, *File.GetFilePath()))
+ {
+ UE_LOG(LogSwagger, Error, TEXT("Failed to load file (%s)"), *File.GetFilePath());
+ return;
+ }
+
+ // Add boundary
+ AppendString(Delimiter);
+ AppendString(*GetBoundary());
+ AppendString(Newline);
+
+ // Add header
+ AppendString(*FString::Printf(TEXT("Content-Disposition: form-data; name=\"%s\"; filename=\"%s\""), Name, *File.GetFilename()));
+ AppendString(Newline);
+ AppendString(*FString::Printf(TEXT("Content-Type: %s"), *File.GetContentType()));
+ AppendString(Newline);
+
+ // Add header to body splitter
+ AppendString(Newline);
+
+ // Add Data
+ FormData.Append(FileContents);
+ AppendString(Newline);
+}
+
+void HttpMultipartFormData::AppendString(const TCHAR* Str)
+{
+ FTCHARToUTF8 utf8Str(Str);
+ FormData.Append((uint8*)utf8Str.Get(), utf8Str.Length());
+}
+
+}
diff --git a/samples/client/petstore-security-test/ue4cpp/Private/SwaggerModule.cpp b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerModule.cpp
new file mode 100644
index 00000000000..27afaf81227
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerModule.cpp
@@ -0,0 +1,24 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#include "SwaggerModule.h"
+
+IMPLEMENT_MODULE(SwaggerModule, Swagger);
+DEFINE_LOG_CATEGORY(LogSwagger);
+
+void SwaggerModule::StartupModule()
+{
+}
+
+void SwaggerModule::ShutdownModule()
+{
+}
+
diff --git a/samples/client/petstore-security-test/ue4cpp/Private/SwaggerModule.h b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerModule.h
new file mode 100644
index 00000000000..dcb7541dbfd
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerModule.h
@@ -0,0 +1,25 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#pragma once
+
+#include "Modules/ModuleInterface.h"
+#include "Modules/ModuleManager.h"
+#include "Logging/LogMacros.h"
+
+DECLARE_LOG_CATEGORY_EXTERN(LogSwagger, Log, All);
+
+class SWAGGER_API SwaggerModule : public IModuleInterface
+{
+public:
+ void StartupModule() final;
+ void ShutdownModule() final;
+};
diff --git a/samples/client/petstore-security-test/ue4cpp/Private/SwaggerReturn.cpp b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerReturn.cpp
new file mode 100644
index 00000000000..be5a6c76ebf
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Private/SwaggerReturn.cpp
@@ -0,0 +1,40 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#include "SwaggerReturn.h"
+
+#include "SwaggerModule.h"
+#include "SwaggerHelpers.h"
+
+#include "Templates/SharedPointer.h"
+
+namespace Swagger
+{
+
+void SwaggerReturn::WriteJson(JsonWriter& Writer) const
+{
+ Writer->WriteObjectStart();
+ if (Return.IsSet())
+ {
+ Writer->WriteIdentifierPrefix(TEXT("return")); WriteJsonValue(Writer, Return.GetValue());
+ }
+ Writer->WriteObjectEnd();
+}
+
+bool SwaggerReturn::FromJson(const TSharedPtr& JsonObject)
+{
+ bool ParseSuccess = true;
+
+ ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("return"), Return);
+
+ return ParseSuccess;
+}
+}
diff --git a/samples/client/petstore-security-test/ue4cpp/Public/SwaggerBaseModel.h b/samples/client/petstore-security-test/ue4cpp/Public/SwaggerBaseModel.h
new file mode 100644
index 00000000000..63af61f5677
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Public/SwaggerBaseModel.h
@@ -0,0 +1,65 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#pragma once
+
+#include "Interfaces/IHttpRequest.h"
+#include "Interfaces/IHttpResponse.h"
+#include "Serialization/JsonWriter.h"
+#include "Dom/JsonObject.h"
+
+namespace Swagger
+{
+
+typedef TSharedRef> JsonWriter;
+
+class SWAGGER_API Model
+{
+public:
+ virtual ~Model() {}
+ virtual void WriteJson(JsonWriter& Writer) const = 0;
+ virtual bool FromJson(const TSharedPtr& JsonObject) = 0;
+};
+
+class SWAGGER_API Request
+{
+public:
+ virtual ~Request() {}
+ virtual void SetupHttpRequest(const TSharedRef& HttpRequest) const = 0;
+ virtual FString ComputePath() const = 0;
+};
+
+class SWAGGER_API Response
+{
+public:
+ virtual ~Response() {}
+ virtual bool FromJson(const TSharedPtr& JsonObject) = 0;
+
+ void SetSuccessful(bool InSuccessful) { Successful = InSuccessful; }
+ bool IsSuccessful() const { return Successful; }
+
+ virtual void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode);
+ EHttpResponseCodes::Type GetHttpResponseCode() const { return ResponseCode; }
+
+ void SetResponseString(const FString& InResponseString) { ResponseString = InResponseString; }
+ const FString& GetResponseString() const { return ResponseString; }
+
+ void SetHttpResponse(const FHttpResponsePtr& InHttpResponse) { HttpResponse = InHttpResponse; }
+ const FHttpResponsePtr& GetHttpResponse() const { return HttpResponse; }
+
+private:
+ bool Successful;
+ EHttpResponseCodes::Type ResponseCode;
+ FString ResponseString;
+ FHttpResponsePtr HttpResponse;
+};
+
+}
diff --git a/samples/client/petstore-security-test/ue4cpp/Public/SwaggerFakeApi.h b/samples/client/petstore-security-test/ue4cpp/Public/SwaggerFakeApi.h
new file mode 100644
index 00000000000..4ac864bcff9
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Public/SwaggerFakeApi.h
@@ -0,0 +1,47 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#pragma once
+
+#include "CoreMinimal.h"
+#include "SwaggerBaseModel.h"
+
+namespace Swagger
+{
+
+class SWAGGER_API SwaggerFakeApi
+{
+public:
+ SwaggerFakeApi();
+ ~SwaggerFakeApi();
+
+ void SetURL(const FString& Url);
+ void AddHeaderParam(const FString& Key, const FString& Value);
+ void ClearHeaderParams();
+
+ class TestCodeInjectEndRnNRRequest;
+ class TestCodeInjectEndRnNRResponse;
+
+ DECLARE_DELEGATE_OneParam(FTestCodeInjectEndRnNRDelegate, const TestCodeInjectEndRnNRResponse&);
+
+ bool TestCodeInjectEndRnNR(const TestCodeInjectEndRnNRRequest& Request, const FTestCodeInjectEndRnNRDelegate& Delegate = FTestCodeInjectEndRnNRDelegate()) const;
+
+private:
+ void OnTestCodeInjectEndRnNRResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FTestCodeInjectEndRnNRDelegate Delegate) const;
+
+ bool IsValid() const;
+ void HandleResponse(FHttpResponsePtr HttpResponse, bool bSucceeded, Response& InOutResponse) const;
+
+ FString Url;
+ TMap AdditionalHeaderParams;
+};
+
+}
diff --git a/samples/client/petstore-security-test/ue4cpp/Public/SwaggerFakeApiOperations.h b/samples/client/petstore-security-test/ue4cpp/Public/SwaggerFakeApiOperations.h
new file mode 100644
index 00000000000..99ee224c3bc
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Public/SwaggerFakeApiOperations.h
@@ -0,0 +1,45 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#pragma once
+
+#include "SwaggerBaseModel.h"
+#include "SwaggerFakeApi.h"
+
+
+namespace Swagger
+{
+
+/* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
+
+*/
+class SWAGGER_API SwaggerFakeApi::TestCodeInjectEndRnNRRequest : public Request
+{
+public:
+ virtual ~TestCodeInjectEndRnNRRequest() {}
+ void SetupHttpRequest(const TSharedRef& HttpRequest) const final;
+ FString ComputePath() const final;
+
+ /* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r */
+ TOptional TestCodeInjectEndRnNR;
+};
+
+class SWAGGER_API SwaggerFakeApi::TestCodeInjectEndRnNRResponse : public Response
+{
+public:
+ virtual ~TestCodeInjectEndRnNRResponse() {}
+ void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
+ bool FromJson(const TSharedPtr& JsonObject) final;
+
+
+};
+
+}
diff --git a/samples/client/petstore-security-test/ue4cpp/Public/SwaggerHelpers.h b/samples/client/petstore-security-test/ue4cpp/Public/SwaggerHelpers.h
new file mode 100644
index 00000000000..218b26444af
--- /dev/null
+++ b/samples/client/petstore-security-test/ue4cpp/Public/SwaggerHelpers.h
@@ -0,0 +1,411 @@
+/**
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
+ *
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+#pragma once
+
+#include "SwaggerBaseModel.h"
+
+#include "Serialization/JsonSerializer.h"
+#include "Dom/JsonObject.h"
+#include "Misc/Base64.h"
+
+class IHttpRequest;
+
+namespace Swagger
+{
+
+typedef TSharedRef> JsonWriter;
+
+//////////////////////////////////////////////////////////////////////////
+
+class SWAGGER_API HttpFileInput
+{
+public:
+ HttpFileInput(const TCHAR* InFilePath);
+ HttpFileInput(const FString& InFilePath);
+
+ // This will automatically set the content type if not already set
+ void SetFilePath(const TCHAR* InFilePath);
+ void SetFilePath(const FString& InFilePath);
+
+ // Optional if it can be deduced from the FilePath
+ void SetContentType(const TCHAR* ContentType);
+
+ HttpFileInput& operator=(const HttpFileInput& Other) = default;
+ HttpFileInput& operator=(const FString& InFilePath) { SetFilePath(*InFilePath); return*this; }
+ HttpFileInput& operator=(const TCHAR* InFilePath) { SetFilePath(InFilePath); return*this; }
+
+ const FString& GetFilePath() const { return FilePath; }
+ const FString& GetContentType() const { return ContentType; }
+
+ // Returns the filename with extension
+ FString GetFilename() const;
+
+private:
+ FString FilePath;
+ FString ContentType;
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+class HttpMultipartFormData
+{
+public:
+ void SetBoundary(const TCHAR* InBoundary);
+ void SetupHttpRequest(const TSharedRef& HttpRequest);
+
+ void AddStringPart(const TCHAR* Name, const TCHAR* Data);
+ void AddJsonPart(const TCHAR* Name, const FString& JsonString);
+ void AddBinaryPart(const TCHAR* Name, const TArray& ByteArray);
+ void AddFilePart(const TCHAR* Name, const HttpFileInput& File);
+
+private:
+ void AppendString(const TCHAR* Str);
+ const FString& GetBoundary() const;
+
+ mutable FString Boundary;
+ TArray FormData;
+
+ static const TCHAR* Delimiter;
+ static const TCHAR* Newline;
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+// Decodes Base64Url encoded strings, see https://en.wikipedia.org/wiki/Base64#Variants_summary_table
+template
+bool Base64UrlDecode(const FString& Base64String, T& Value)
+{
+ FString TmpCopy(Base64String);
+ TmpCopy.ReplaceInline(TEXT("-"), TEXT("+"));
+ TmpCopy.ReplaceInline(TEXT("_"), TEXT("/"));
+
+ return FBase64::Decode(TmpCopy, Value);
+}
+
+// Encodes strings in Base64Url, see https://en.wikipedia.org/wiki/Base64#Variants_summary_table
+template
+FString Base64UrlEncode(const T& Value)
+{
+ FString Base64String = FBase64::Encode(Value);
+ Base64String.ReplaceInline(TEXT("+"), TEXT("-"));
+ Base64String.ReplaceInline(TEXT("/"), TEXT("_"));
+ return Base64String;
+}
+
+template
+inline FStringFormatArg ToStringFormatArg(const T& Value)
+{
+ return FStringFormatArg(Value);
+}
+
+inline FStringFormatArg ToStringFormatArg(const FDateTime& Value)
+{
+ return FStringFormatArg(Value.ToIso8601());
+}
+
+inline FStringFormatArg ToStringFormatArg(const TArray& Value)
+{
+ return FStringFormatArg(Base64UrlEncode(Value));
+}
+
+template::value, int>::type = 0>
+inline FString ToString(const T& Value)
+{
+ return FString::Format(TEXT("{0}"), { ToStringFormatArg(Value) });
+}
+
+inline FString ToString(const FString& Value)
+{
+ return Value;
+}
+
+inline FString ToString(const TArray& Value)
+{
+ return Base64UrlEncode(Value);
+}
+
+inline FString ToString(const Model& Value)
+{
+ FString String;
+ JsonWriter Writer = TJsonWriterFactory<>::Create(&String);
+ Value.WriteJson(Writer);
+ Writer->Close();
+ return String;
+}
+
+template
+inline FString ToUrlString(const T& Value)
+{
+ return FPlatformHttp::UrlEncode(ToString(Value));
+}
+
+template
+inline FString CollectionToUrlString(const TArray& Collection, const TCHAR* Separator)
+{
+ FString Output;
+ if(Collection.Num() == 0)
+ return Output;
+
+ Output += ToUrlString(Collection[0]);
+ for(int i = 1; i < Collection.Num(); i++)
+ {
+ Output += FString::Format(TEXT("{0}{1}"), { Separator, *ToUrlString(Collection[i]) });
+ }
+ return Output;
+}
+
+template
+inline FString CollectionToUrlString_csv(const TArray& Collection, const TCHAR* BaseName)
+{
+ return CollectionToUrlString(Collection, TEXT(","));
+}
+
+template
+inline FString CollectionToUrlString_ssv(const TArray& Collection, const TCHAR* BaseName)
+{
+ return CollectionToUrlString(Collection, TEXT(" "));
+}
+
+template
+inline FString CollectionToUrlString_tsv(const TArray& Collection, const TCHAR* BaseName)
+{
+ return CollectionToUrlString(Collection, TEXT("\t"));
+}
+
+template
+inline FString CollectionToUrlString_pipes(const TArray& Collection, const TCHAR* BaseName)
+{
+ return CollectionToUrlString(Collection, TEXT("|"));
+}
+
+template
+inline FString CollectionToUrlString_multi(const TArray& Collection, const TCHAR* BaseName)
+{
+ FString Output;
+ if(Collection.Num() == 0)
+ return Output;
+
+ Output += FString::Format(TEXT("{0}={1}"), { FStringFormatArg(BaseName), ToUrlString(Collection[0]) });
+ for(int i = 1; i < Collection.Num(); i++)
+ {
+ Output += FString::Format(TEXT("&{0}={1}"), { FStringFormatArg(BaseName), ToUrlString(Collection[i]) });
+ }
+ return Output;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+template::value, int>::type = 0>
+inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
+{
+ Writer->WriteValue(Value);
+}
+
+inline void WriteJsonValue(JsonWriter& Writer, const FDateTime& Value)
+{
+ Writer->WriteValue(Value.ToIso8601());
+}
+
+inline void WriteJsonValue(JsonWriter& Writer, const Model& Value)
+{
+ Value.WriteJson(Writer);
+}
+
+template
+inline void WriteJsonValue(JsonWriter& Writer, const TArray& Value)
+{
+ Writer->WriteArrayStart();
+ for (const auto& Element : Value)
+ {
+ WriteJsonValue(Writer, Element);
+ }
+ Writer->WriteArrayEnd();
+}
+
+template
+inline void WriteJsonValue(JsonWriter& Writer, const TMap& Value)
+{
+ Writer->WriteObjectStart();
+ for (const auto& It : Value)
+ {
+ Writer->WriteIdentifierPrefix(It.Key);
+ WriteJsonValue(Writer, It.Value);
+ }
+ Writer->WriteObjectEnd();
+}
+
+inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr& Value)
+{
+ if (Value.IsValid())
+ {
+ FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
+ }
+ else
+ {
+ Writer->WriteObjectStart();
+ Writer->WriteObjectEnd();
+ }
+}
+
+inline void WriteJsonValue(JsonWriter& Writer, const TArray& Value)
+{
+ Writer->WriteValue(ToString(Value));
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+template
+inline bool TryGetJsonValue(const TSharedPtr& JsonObject, const FString& Key, T& Value)
+{
+ const TSharedPtr JsonValue = JsonObject->TryGetField(Key);
+ if (JsonValue.IsValid() && !JsonValue->IsNull())
+ {
+ return TryGetJsonValue(JsonValue, Value);
+ }
+ return false;
+}
+
+template
+inline bool TryGetJsonValue(const TSharedPtr& JsonObject, const FString& Key, TOptional& 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& JsonValue, FString& Value)
+{
+ FString TmpValue;
+ if (JsonValue->TryGetString(TmpValue))
+ {
+ Value = TmpValue;
+ return true;
+ }
+ else
+ return false;
+}
+
+inline bool TryGetJsonValue(const TSharedPtr& JsonValue, FDateTime& Value)
+{
+ FString TmpValue;
+ if (JsonValue->TryGetString(TmpValue))
+ return FDateTime::Parse(TmpValue, Value);
+ else
+ return false;
+}
+
+inline bool TryGetJsonValue(const TSharedPtr& JsonValue, bool& Value)
+{
+ bool TmpValue;
+ if (JsonValue->TryGetBool(TmpValue))
+ {
+ Value = TmpValue;
+ return true;
+ }
+ else
+ return false;
+}
+
+template::value, int>::type = 0>
+inline bool TryGetJsonValue(const TSharedPtr& JsonValue, T& Value)
+{
+ T TmpValue;
+ if (JsonValue->TryGetNumber(TmpValue))
+ {
+ Value = TmpValue;
+ return true;
+ }
+ else
+ return false;
+}
+
+inline bool TryGetJsonValue(const TSharedPtr& JsonValue, Model& Value)
+{
+ const TSharedPtr* Object;
+ if (JsonValue->TryGetObject(Object))
+ return Value.FromJson(*Object);
+ else
+ return false;
+}
+
+template
+inline bool TryGetJsonValue(const TSharedPtr& JsonValue, TArray& ArrayValue)
+{
+ const TArray>* JsonArray;
+ if (JsonValue->TryGetArray(JsonArray))
+ {
+ bool ParseSuccess = true;
+ const int32 Count = JsonArray->Num();
+ ArrayValue.Reset(Count);
+ for (int i = 0; i < Count; i++)
+ {
+ T TmpValue;
+ ParseSuccess &= TryGetJsonValue((*JsonArray)[i], TmpValue);
+ ArrayValue.Emplace(MoveTemp(TmpValue));
+ }
+ return ParseSuccess;
+ }
+ return false;
+}
+
+template
+inline bool TryGetJsonValue(const TSharedPtr