From c653aeec0bb643409b6f22f67927d8d428af9f7a Mon Sep 17 00:00:00 2001 From: Jakub Malek Date: Tue, 24 May 2016 10:25:18 +0200 Subject: [PATCH] NancyFX: - Fixed parsing enum parameters in NancyModule --- .../swagger-codegen/src/main/resources/nancyfx/api.mustache | 5 +++-- .../src/main/resources/nancyfx/model.mustache | 2 +- 2 files changed, 4 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 537f590009..c70159701a 100644 --- a/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache +++ b/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache @@ -8,14 +8,15 @@ using {{packageName}}.Utils; namespace {{packageName}}.Modules { -{{#operations}}{{#operation}}{{#allParams}}{{#isEnum}}{{>innerApiEnum}}{{/isEnum}}{{/allParams}}{{/operation}} public sealed class {{classname}}Module : NancyModule +{{#operations}}{{#operation}}{{#allParams}}{{#isEnum}} {{>innerApiEnum}}{{/isEnum}}{{/allParams}} +{{/operation}} public sealed class {{classname}}Module : NancyModule { public {{classname}}Module({{classname}}Service service) :base("") { {{#operation}} {{httpMethod}}["{{path}}"] = parameters => { - {{#allParams}}{{#isBodyParam}}var {{paramName}} = this.Bind<{{&dataType}}>();{{/isBodyParam}}{{^isBodyParam}}{{#isEnum}}{{>innerApiEnumName}}{{/isEnum}}{{^isEnum}}var{{/isEnum}} {{paramName}} = Parameters.ValueOf<{{&dataType}}>(parameters, "{{paramName}}");{{#hasMore}} + {{#allParams}}{{#isBodyParam}}var {{paramName}} = this.Bind<{{&dataType}}>();{{/isBodyParam}}{{^isBodyParam}}{{#isEnum}}var {{paramName}} = Parameters.ValueOf<{{>innerApiEnumName}}>(parameters, "{{paramName}}");{{/isEnum}}{{^isEnum}}var {{paramName}} = Parameters.ValueOf<{{&dataType}}>(parameters, "{{paramName}}");{{/isEnum}}{{#hasMore}} {{/hasMore}}{{/isBodyParam}}{{/allParams}}{{#allParams}}{{#required}} Preconditions.IsNotNull({{paramName}}, "Required parameter: '{{paramName}}' is missing at '{{operationId}}'"); {{/required}}{{/allParams}} diff --git a/modules/swagger-codegen/src/main/resources/nancyfx/model.mustache b/modules/swagger-codegen/src/main/resources/nancyfx/model.mustache index b7972357c2..c2b7e7c43a 100644 --- a/modules/swagger-codegen/src/main/resources/nancyfx/model.mustache +++ b/modules/swagger-codegen/src/main/resources/nancyfx/model.mustache @@ -46,7 +46,7 @@ namespace {{packageName}}.Models public bool Equals({{classname}} other) { - return this.Equals((object) other); + return Equals((object) other); } public override int GetHashCode()