From d780e3a5f559f9a9b49625688b9158906f32e857 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 19 Jul 2016 15:16:07 +0800 Subject: [PATCH] fix #3400 (ruby minLenght, maxLength) --- .../swagger-codegen/src/main/resources/ruby/api.mustache | 8 ++++---- .../main/resources/ruby/partial_model_generic.mustache | 8 ++++---- samples/client/petstore/ruby/README.md | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/ruby/api.mustache b/modules/swagger-codegen/src/main/resources/ruby/api.mustache index 7b333428899..53e455649cd 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api.mustache @@ -56,18 +56,18 @@ module {{moduleName}} {{/isEnum}} {{/required}} {{#hasValidation}} - {{#minLength}} + {{#maxLength}} if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length > {{{maxLength}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, the character length must be smaller than or equal to {{{maxLength}}}.' end - {{/minLength}} - {{#maxLength}} + {{/maxLength}} + {{#minLength}} if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length < {{{minLength}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, the character length must be great than or equal to {{{minLength}}}.' end - {{/maxLength}} + {{/minLength}} {{#maximum}} if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} > {{{maximum}}} fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{{maximum}}}.' diff --git a/modules/swagger-codegen/src/main/resources/ruby/partial_model_generic.mustache b/modules/swagger-codegen/src/main/resources/ruby/partial_model_generic.mustache index 95c818a5ac4..690b1534e96 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/partial_model_generic.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/partial_model_generic.mustache @@ -82,18 +82,18 @@ fail ArgumentError, "{{{name}}} cannot be nil" end - {{#minLength}} + {{#maxLength}} if @{{{name}}}.to_s.length > {{{maxLength}}} invalid_properties.push("invalid value for '{{{name}}}', the character length must be smaller than or equal to {{{maxLength}}}.") end - {{/minLength}} - {{#maxLength}} + {{/maxLength}} + {{#minLength}} if @{{{name}}}.to_s.length < {{{minLength}}} invalid_properties.push("invalid value for '{{{name}}}', the character length must be great than or equal to {{{minLength}}}.") end - {{/maxLength}} + {{/minLength}} {{#maximum}} if @{{{name}}} > {{{maximum}}} invalid_properties.push("invalid value for '{{{name}}}', must be smaller than or equal to {{{maximum}}}.") diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 56418b4412b..28228a68b4c 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-07-14T16:12:28.313+08:00 +- Build date: 2016-07-19T15:06:57.795+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation