From 1896e9664862b32137f0d57e01e2e5e052c814ff Mon Sep 17 00:00:00 2001 From: craffael Date: Tue, 3 Oct 2017 09:14:28 +0200 Subject: [PATCH] [nancyfx] fix interface prefix (#6595) * Retrofit2: Return ResponseBody if response if file. Until now -------------------- If a swagger endpoint returned a file (e.g. an image), then the Retrofit2 template has choosen the return type java.io.File. However, retrofit cannot deal with this and throws a com.google.gson.stream.MalformedJsonException. New: ------------------- If a swagger endpoint returns a file, then the corresponding Retrofit2 endpoint will return a okhttp3.ResponseBody which can be used to retrieve the file. * fix Interface Prefix --- modules/swagger-codegen/src/main/resources/nancyfx/api.mustache | 2 +- samples/server/petstore/nancyfx/IO.Swagger.sln | 2 +- .../server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache b/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache index a2634d9ab81..038977fb6d4 100644 --- a/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache +++ b/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache @@ -22,7 +22,7 @@ namespace {{packageName}}.{{packageContext}}.Modules /// Sets up HTTP methods mappings. /// /// Service handling requests - public {{classname}}Module({{classname}}Service service) : base("{{{baseContext}}}") + public {{classname}}Module({{interfacePrefix}}{{classname}}Service service) : base("{{{baseContext}}}") { {{#operation}} {{httpMethod}}["{{{path}}}"] = parameters => { diff --git a/samples/server/petstore/nancyfx/IO.Swagger.sln b/samples/server/petstore/nancyfx/IO.Swagger.sln index 234aa6fb01c..680fe56caa0 100644 --- a/samples/server/petstore/nancyfx/IO.Swagger.sln +++ b/samples/server/petstore/nancyfx/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{DFBD27E3-36EF-45CB-9D6D-EF500915B5CF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{19B8107D-38E2-4D32-B74F-C45470A9FCA3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj index 6c13d64b402..b7bb26dd9df 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {DFBD27E3-36EF-45CB-9D6D-EF500915B5CF} + {19B8107D-38E2-4D32-B74F-C45470A9FCA3} Library Properties IO.Swagger.v2