mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-01 13:10:52 +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}}
|
||||
{{/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}}}.'
|
||||
|
@ -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}}}.")
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user