mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-01 21:20:55 +00:00
Merge pull request #3402 from wing328/ruby_fix_minlength
[Ruby] Fix minLength, maxLength
This commit is contained in:
commit
207622a8f8
@ -56,18 +56,18 @@ module {{moduleName}}
|
|||||||
{{/isEnum}}
|
{{/isEnum}}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{#hasValidation}}
|
{{#hasValidation}}
|
||||||
{{#minLength}}
|
{{#maxLength}}
|
||||||
if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length > {{{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}}}.'
|
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
|
end
|
||||||
|
|
||||||
{{/minLength}}
|
{{/maxLength}}
|
||||||
{{#maxLength}}
|
{{#minLength}}
|
||||||
if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length < {{{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}}}.'
|
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
|
end
|
||||||
|
|
||||||
{{/maxLength}}
|
{{/minLength}}
|
||||||
{{#maximum}}
|
{{#maximum}}
|
||||||
if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} > {{{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}}}.'
|
fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{{maximum}}}.'
|
||||||
|
@ -82,18 +82,18 @@
|
|||||||
fail ArgumentError, "{{{name}}} cannot be nil"
|
fail ArgumentError, "{{{name}}} cannot be nil"
|
||||||
end
|
end
|
||||||
|
|
||||||
{{#minLength}}
|
{{#maxLength}}
|
||||||
if @{{{name}}}.to_s.length > {{{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}}}.")
|
invalid_properties.push("invalid value for '{{{name}}}', the character length must be smaller than or equal to {{{maxLength}}}.")
|
||||||
end
|
end
|
||||||
|
|
||||||
{{/minLength}}
|
{{/maxLength}}
|
||||||
{{#maxLength}}
|
{{#minLength}}
|
||||||
if @{{{name}}}.to_s.length < {{{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}}}.")
|
invalid_properties.push("invalid value for '{{{name}}}', the character length must be great than or equal to {{{minLength}}}.")
|
||||||
end
|
end
|
||||||
|
|
||||||
{{/maxLength}}
|
{{/minLength}}
|
||||||
{{#maximum}}
|
{{#maximum}}
|
||||||
if @{{{name}}} > {{{maximum}}}
|
if @{{{name}}} > {{{maximum}}}
|
||||||
invalid_properties.push("invalid value for '{{{name}}}', must be smaller than or equal to {{{maximum}}}.")
|
invalid_properties.push("invalid value for '{{{name}}}', must be smaller than or equal to {{{maximum}}}.")
|
||||||
|
@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
|
|||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Package 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
|
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user