sinatra-swagger-exposer 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +0 -1
- data/README.md +1 -0
- data/lib/sinatra/swagger-exposer/configuration/swagger-configuration-utilities.rb +124 -0
- data/lib/sinatra/swagger-exposer/configuration/swagger-endpoint-parameter.rb +15 -20
- data/lib/sinatra/swagger-exposer/configuration/swagger-endpoint-response.rb +39 -7
- data/lib/sinatra/swagger-exposer/configuration/swagger-endpoint.rb +21 -8
- data/lib/sinatra/swagger-exposer/configuration/swagger-hash-like.rb +45 -0
- data/lib/sinatra/swagger-exposer/configuration/swagger-info.rb +9 -8
- data/lib/sinatra/swagger-exposer/configuration/swagger-response-header.rb +68 -0
- data/lib/sinatra/swagger-exposer/configuration/swagger-response-headers.rb +33 -0
- data/lib/sinatra/swagger-exposer/configuration/swagger-type-property.rb +7 -6
- data/lib/sinatra/swagger-exposer/configuration/swagger-type.rb +10 -9
- data/lib/sinatra/swagger-exposer/configuration/swagger-types.rb +4 -20
- data/lib/sinatra/swagger-exposer/processing/swagger-array-value-processor.rb +46 -0
- data/lib/sinatra/swagger-exposer/processing/{swagger-base-value-preprocessor.rb → swagger-base-value-processor.rb} +9 -7
- data/lib/sinatra/swagger-exposer/processing/{swagger-parameter-preprocessor.rb → swagger-parameter-processor.rb} +9 -9
- data/lib/sinatra/swagger-exposer/processing/{swagger-primitive-value-preprocessor.rb → swagger-primitive-value-processor.rb} +46 -46
- data/lib/sinatra/swagger-exposer/processing/{swagger-preprocessor-dispatcher.rb → swagger-processor-dispatcher.rb} +11 -11
- data/lib/sinatra/swagger-exposer/processing/swagger-request-processor.rb +123 -0
- data/lib/sinatra/swagger-exposer/processing/swagger-response-processor.rb +47 -0
- data/lib/sinatra/swagger-exposer/processing/swagger-type-value-processor.rb +37 -0
- data/lib/sinatra/swagger-exposer/swagger-content-creator.rb +3 -7
- data/lib/sinatra/swagger-exposer/swagger-exposer.rb +99 -33
- data/lib/sinatra/swagger-exposer/swagger-parameter-helper.rb +19 -19
- data/lib/sinatra/swagger-exposer/swagger-request-processor-creator.rb +180 -0
- data/lib/sinatra/swagger-exposer/version.rb +1 -1
- data/sinatra-swagger-exposer.gemspec +9 -8
- metadata +29 -11
- data/lib/sinatra/swagger-exposer/processing/swagger-array-value-preprocessor.rb +0 -46
- data/lib/sinatra/swagger-exposer/processing/swagger-request-preprocessor.rb +0 -64
- data/lib/sinatra/swagger-exposer/processing/swagger-type-value-preprocessor.rb +0 -37
- data/lib/sinatra/swagger-exposer/swagger-preprocessor-creator.rb +0 -137
- data/lib/sinatra/swagger-exposer/swagger-utilities.rb +0 -108
@@ -0,0 +1,68 @@
|
|
1
|
+
require_relative '../swagger-invalid-exception'
|
2
|
+
|
3
|
+
require_relative 'swagger-parameter-validation-helper'
|
4
|
+
require_relative 'swagger-type-property'
|
5
|
+
require_relative 'swagger-configuration-utilities'
|
6
|
+
|
7
|
+
module Sinatra
|
8
|
+
|
9
|
+
module SwaggerExposer
|
10
|
+
|
11
|
+
module Configuration
|
12
|
+
|
13
|
+
class SwaggerResponseHeader
|
14
|
+
|
15
|
+
include SwaggerConfigurationUtilities
|
16
|
+
include SwaggerParameterValidationHelper
|
17
|
+
|
18
|
+
attr_reader :type, :name, :description
|
19
|
+
|
20
|
+
PRIMITIVE_HEADERS_TYPES = [
|
21
|
+
TYPE_STRING,
|
22
|
+
TYPE_NUMBER,
|
23
|
+
TYPE_INTEGER,
|
24
|
+
TYPE_BOOLEAN,
|
25
|
+
]
|
26
|
+
|
27
|
+
# Create a new instance
|
28
|
+
# @param name [String] the name
|
29
|
+
# @param description [String] the description
|
30
|
+
# @param type [String] the type name
|
31
|
+
def initialize(name, type, description)
|
32
|
+
check_name(name)
|
33
|
+
@name = name
|
34
|
+
|
35
|
+
if description
|
36
|
+
@description = description
|
37
|
+
end
|
38
|
+
|
39
|
+
get_type(type, PRIMITIVE_HEADERS_TYPES)
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# Return the swagger version
|
44
|
+
# @return [Hash]
|
45
|
+
def to_swagger
|
46
|
+
result = {
|
47
|
+
:type => @type,
|
48
|
+
}
|
49
|
+
|
50
|
+
if @description
|
51
|
+
result[:description] = @description
|
52
|
+
end
|
53
|
+
|
54
|
+
result
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_s
|
58
|
+
{
|
59
|
+
:name => @name,
|
60
|
+
:type => @type,
|
61
|
+
:description => @description,
|
62
|
+
}.to_json
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative 'swagger-hash-like'
|
2
|
+
require_relative 'swagger-response-header'
|
3
|
+
|
4
|
+
module Sinatra
|
5
|
+
|
6
|
+
module SwaggerExposer
|
7
|
+
|
8
|
+
module Configuration
|
9
|
+
|
10
|
+
# Contain all the declared response headers
|
11
|
+
class SwaggerResponseHeaders < SwaggerHashLike
|
12
|
+
|
13
|
+
attr_reader :response_headers
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@response_headers = {}
|
17
|
+
super(@response_headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Add a new swagger response header
|
21
|
+
# @param name [String] the type name
|
22
|
+
# @param type [Object] the type
|
23
|
+
# @param description [String] the description
|
24
|
+
def add_response_header(name, type, description)
|
25
|
+
name = name.to_s
|
26
|
+
check_duplicate(name, 'Response header')
|
27
|
+
@response_headers[name] = SwaggerResponseHeader.new(name, type, description)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative '../swagger-invalid-exception'
|
2
|
-
|
2
|
+
|
3
|
+
require_relative 'swagger-configuration-utilities'
|
3
4
|
require_relative 'swagger-parameter-validation-helper'
|
4
5
|
|
5
6
|
module Sinatra
|
@@ -12,7 +13,7 @@ module Sinatra
|
|
12
13
|
|
13
14
|
attr_reader :name, :type, :items
|
14
15
|
|
15
|
-
include
|
16
|
+
include SwaggerConfigurationUtilities
|
16
17
|
include SwaggerParameterValidationHelper
|
17
18
|
|
18
19
|
OTHER_PROPERTIES = [:example, :description, :format, :minLength, :maxLength, :default]
|
@@ -69,10 +70,10 @@ module Sinatra
|
|
69
70
|
|
70
71
|
def to_s
|
71
72
|
{
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
:name => @name,
|
74
|
+
:type => @type,
|
75
|
+
:items => @items,
|
76
|
+
:other_properties => @other_properties,
|
76
77
|
}.to_json
|
77
78
|
end
|
78
79
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative '../swagger-invalid-exception'
|
2
|
-
|
2
|
+
|
3
|
+
require_relative 'swagger-configuration-utilities'
|
3
4
|
require_relative 'swagger-type-property'
|
4
5
|
|
5
6
|
module Sinatra
|
@@ -12,7 +13,7 @@ module Sinatra
|
|
12
13
|
|
13
14
|
attr_reader :properties, :required, :extends
|
14
15
|
|
15
|
-
include
|
16
|
+
include SwaggerConfigurationUtilities
|
16
17
|
|
17
18
|
PROPERTY_PROPERTIES = :properties
|
18
19
|
PROPERTY_REQUIRED = :required
|
@@ -103,10 +104,10 @@ module Sinatra
|
|
103
104
|
|
104
105
|
if @extends
|
105
106
|
result = {
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
107
|
+
:allOf => [
|
108
|
+
ref_to_type(@extends),
|
109
|
+
result
|
110
|
+
]
|
110
111
|
}
|
111
112
|
end
|
112
113
|
|
@@ -115,9 +116,9 @@ module Sinatra
|
|
115
116
|
|
116
117
|
def to_s
|
117
118
|
{
|
118
|
-
|
119
|
-
|
120
|
-
|
119
|
+
:properties => @properties,
|
120
|
+
:required => @required,
|
121
|
+
:example => @example,
|
121
122
|
}.to_json
|
122
123
|
end
|
123
124
|
|
@@ -1,6 +1,5 @@
|
|
1
|
+
require_relative 'swagger-hash-like'
|
1
2
|
require_relative 'swagger-type'
|
2
|
-
require_relative '../swagger-utilities'
|
3
|
-
require_relative '../swagger-invalid-exception'
|
4
3
|
|
5
4
|
module Sinatra
|
6
5
|
|
@@ -9,27 +8,20 @@ module Sinatra
|
|
9
8
|
module Configuration
|
10
9
|
|
11
10
|
# Contain all the declared types
|
12
|
-
class SwaggerTypes
|
11
|
+
class SwaggerTypes < SwaggerHashLike
|
13
12
|
|
14
13
|
attr_reader :types
|
15
14
|
|
16
|
-
include Sinatra::SwaggerExposer::SwaggerUtilities
|
17
|
-
|
18
15
|
def initialize
|
19
16
|
@types = {}
|
20
|
-
|
21
|
-
|
22
|
-
def [](name)
|
23
|
-
@types[name]
|
17
|
+
super(types)
|
24
18
|
end
|
25
19
|
|
26
20
|
# Add a new swagger type
|
27
21
|
# @param name [String] the type name
|
28
22
|
# @param params [Hash] the type params
|
29
23
|
def add_type(name, params)
|
30
|
-
|
31
|
-
raise SwaggerInvalidException.new("Type [#{name}] already exist with value #{@types[name]}")
|
32
|
-
end
|
24
|
+
check_duplicate(name, 'Type')
|
33
25
|
@types[name] = SwaggerType.new(name, params, @types.keys)
|
34
26
|
end
|
35
27
|
|
@@ -37,14 +29,6 @@ module Sinatra
|
|
37
29
|
@types.keys
|
38
30
|
end
|
39
31
|
|
40
|
-
def to_swagger
|
41
|
-
if @types.empty?
|
42
|
-
nil
|
43
|
-
else
|
44
|
-
hash_to_swagger(@types)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
32
|
end
|
49
33
|
end
|
50
34
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative '../swagger-parameter-helper'
|
2
|
+
require_relative '../swagger-invalid-exception'
|
3
|
+
require_relative 'swagger-base-value-processor'
|
4
|
+
|
5
|
+
module Sinatra
|
6
|
+
|
7
|
+
module SwaggerExposer
|
8
|
+
|
9
|
+
module Processing
|
10
|
+
|
11
|
+
# Validate arrays
|
12
|
+
class SwaggerArrayValueProcessor < SwaggerBaseValueProcessor
|
13
|
+
|
14
|
+
include Sinatra::SwaggerExposer::SwaggerParameterHelper
|
15
|
+
|
16
|
+
attr_reader :processor_for_values
|
17
|
+
|
18
|
+
# Initialize
|
19
|
+
# @param name [String] the name
|
20
|
+
# @param required [TrueClass] if the parameter is required
|
21
|
+
# @param processor_for_values [Sinatra::SwaggerExposer::Processing::SwaggerBaseValueProcessor] processor for the values
|
22
|
+
def initialize(name, required, processor_for_values)
|
23
|
+
super(name, required, nil)
|
24
|
+
@processor_for_values = processor_for_values
|
25
|
+
end
|
26
|
+
|
27
|
+
def useful?
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def validate_value(value)
|
32
|
+
if value
|
33
|
+
if value.is_a? Array
|
34
|
+
value.collect { |i| @processor_for_values.validate_value(i) }
|
35
|
+
else
|
36
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be an array but is [#{value}]")
|
37
|
+
end
|
38
|
+
else
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -7,8 +7,8 @@ module Sinatra
|
|
7
7
|
|
8
8
|
module Processing
|
9
9
|
|
10
|
-
# Base class for value
|
11
|
-
class
|
10
|
+
# Base class for value processor
|
11
|
+
class SwaggerBaseValueProcessor
|
12
12
|
|
13
13
|
attr_reader :name, :required
|
14
14
|
|
@@ -18,24 +18,26 @@ module Sinatra
|
|
18
18
|
# @param name [String] the name
|
19
19
|
# @param required [TrueClass] if the parameter is required
|
20
20
|
# @param default [Object] the default value
|
21
|
-
def initialize(name, required, default
|
21
|
+
def initialize(name, required, default)
|
22
22
|
@name = name.to_s
|
23
23
|
@required = required
|
24
24
|
@default = default
|
25
25
|
end
|
26
26
|
|
27
|
+
# Test if the processor is useful
|
28
|
+
# @return [TrueClass]
|
27
29
|
def useful?
|
28
30
|
@required || (!@default.nil?)
|
29
31
|
end
|
30
32
|
|
31
33
|
def process(params)
|
32
34
|
unless params.is_a? Hash
|
33
|
-
raise SwaggerInvalidException.new("
|
35
|
+
raise SwaggerInvalidException.new("Value [#{@name}] should be an object but is a [#{params.class}]")
|
34
36
|
end
|
35
|
-
if params.key?(@name)
|
36
|
-
params[@name] =
|
37
|
+
if params.key?(@name) && (!params[@name].nil?)
|
38
|
+
params[@name] = validate_value(params[@name])
|
37
39
|
elsif @required
|
38
|
-
raise SwaggerInvalidException.new("Mandatory
|
40
|
+
raise SwaggerInvalidException.new("Mandatory value [#{@name}] is missing")
|
39
41
|
elsif @default
|
40
42
|
params[@name] = @default
|
41
43
|
end
|
@@ -9,20 +9,20 @@ module Sinatra
|
|
9
9
|
module Processing
|
10
10
|
|
11
11
|
# Process the parameters for validation and enrichment
|
12
|
-
class
|
12
|
+
class SwaggerParameterProcessor
|
13
13
|
|
14
14
|
include Sinatra::SwaggerExposer::SwaggerParameterHelper
|
15
15
|
|
16
16
|
# Initialize
|
17
17
|
# @param how_to_pass [String] how to pass the parameter
|
18
|
-
# @param
|
19
|
-
def initialize(how_to_pass,
|
18
|
+
# @param value_processor [Sinatra::SwaggerExposer::Processing::SwaggerBaseValueProcessor] the parameter processor
|
19
|
+
def initialize(how_to_pass, value_processor)
|
20
20
|
@how_to_pass = how_to_pass
|
21
|
-
@
|
22
|
-
@useful = @
|
21
|
+
@value_processor = value_processor
|
22
|
+
@useful = @value_processor.useful?
|
23
23
|
end
|
24
24
|
|
25
|
-
# Is the
|
25
|
+
# Is the processor useful
|
26
26
|
# @return [TrueClass]
|
27
27
|
def useful?
|
28
28
|
@useful
|
@@ -33,11 +33,11 @@ module Sinatra
|
|
33
33
|
when HOW_TO_PASS_PATH
|
34
34
|
# can't validate
|
35
35
|
when HOW_TO_PASS_QUERY
|
36
|
-
@
|
36
|
+
@value_processor.validate(app.params)
|
37
37
|
when HOW_TO_PASS_HEADER
|
38
|
-
@
|
38
|
+
@value_processor.validate(app.headers)
|
39
39
|
when HOW_TO_PASS_BODY
|
40
|
-
@
|
40
|
+
@value_processor.validate(parsed_body || {})
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
|
-
require_relative 'swagger-base-value-
|
3
|
+
require_relative 'swagger-base-value-processor'
|
4
4
|
require_relative '../swagger-parameter-helper'
|
5
5
|
require_relative '../swagger-invalid-exception'
|
6
6
|
|
@@ -10,8 +10,8 @@ module Sinatra
|
|
10
10
|
|
11
11
|
module Processing
|
12
12
|
|
13
|
-
# Validate primitive
|
14
|
-
class
|
13
|
+
# Validate primitive value
|
14
|
+
class SwaggerPrimitiveValueProcessor < SwaggerBaseValueProcessor
|
15
15
|
|
16
16
|
include Sinatra::SwaggerExposer::SwaggerParameterHelper
|
17
17
|
|
@@ -31,67 +31,67 @@ module Sinatra
|
|
31
31
|
|
32
32
|
def useful?
|
33
33
|
super ||
|
34
|
-
|
35
|
-
|
34
|
+
[TYPE_NUMBER, TYPE_INTEGER, TYPE_BOOLEAN, TYPE_DATE_TIME].include?(@type) || # Must check type
|
35
|
+
(@params.key? PARAMS_MIN_LENGTH) || (@params.key? PARAMS_MAX_LENGTH) # Must check string
|
36
36
|
end
|
37
37
|
|
38
38
|
# Dispatch method
|
39
|
-
def
|
39
|
+
def validate_value(value)
|
40
40
|
case @type
|
41
41
|
when TYPE_NUMBER
|
42
|
-
return
|
42
|
+
return validate_value_number(value)
|
43
43
|
when TYPE_INTEGER
|
44
|
-
return
|
44
|
+
return validate_value_integer(value)
|
45
45
|
when TYPE_BOOLEAN
|
46
|
-
return
|
46
|
+
return validate_value_boolean(value)
|
47
47
|
when TYPE_DATE_TIME
|
48
|
-
return
|
48
|
+
return validate_value_date_time(value)
|
49
49
|
else
|
50
|
-
return
|
50
|
+
return validate_value_string(value)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
# Validate a boolean
|
55
|
-
def
|
54
|
+
# Validate a boolean
|
55
|
+
def validate_value_boolean(value)
|
56
56
|
if (value == 'true') || value.is_a?(TrueClass)
|
57
|
-
|
57
|
+
true
|
58
58
|
elsif (value == 'false') || value.is_a?(FalseClass)
|
59
|
-
|
59
|
+
false
|
60
60
|
else
|
61
|
-
raise SwaggerInvalidException.new("
|
61
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be an boolean but is [#{value}]")
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
# Validate an integer
|
66
|
-
def
|
65
|
+
# Validate an integer
|
66
|
+
def validate_value_integer(value)
|
67
67
|
begin
|
68
68
|
f = Float(value)
|
69
69
|
i = Integer(value)
|
70
70
|
if f == i
|
71
71
|
i
|
72
72
|
else
|
73
|
-
raise SwaggerInvalidException.new("
|
73
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be an integer but is [#{value}]")
|
74
74
|
end
|
75
75
|
value = Integer(value)
|
76
76
|
validate_numerical_value(value)
|
77
77
|
value
|
78
78
|
rescue ArgumentError
|
79
|
-
raise SwaggerInvalidException.new("
|
79
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be an integer but is [#{value}]")
|
80
80
|
rescue TypeError
|
81
|
-
raise SwaggerInvalidException.new("
|
81
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be an integer but is [#{value}]")
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
# Validate a number
|
86
|
-
def
|
85
|
+
# Validate a number value
|
86
|
+
def validate_value_number(value)
|
87
87
|
begin
|
88
88
|
value = Float(value)
|
89
89
|
validate_numerical_value(value)
|
90
90
|
return value
|
91
91
|
rescue ArgumentError
|
92
|
-
raise SwaggerInvalidException.new("
|
92
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be a float but is [#{value}]")
|
93
93
|
rescue TypeError
|
94
|
-
raise SwaggerInvalidException.new("
|
94
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be a float but is [#{value}]")
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -99,46 +99,46 @@ module Sinatra
|
|
99
99
|
# @param value [Numeric] the value
|
100
100
|
def validate_numerical_value(value)
|
101
101
|
validate_numerical_value_internal(
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
102
|
+
value,
|
103
|
+
PARAMS_MINIMUM,
|
104
|
+
PARAMS_EXCLUSIVE_MINIMUM,
|
105
|
+
'>=',
|
106
|
+
'>')
|
107
107
|
validate_numerical_value_internal(
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
value,
|
109
|
+
PARAMS_MAXIMUM,
|
110
|
+
PARAMS_EXCLUSIVE_MAXIMUM,
|
111
|
+
'<=',
|
112
|
+
'<')
|
113
113
|
end
|
114
114
|
|
115
|
-
# Validate a date time
|
116
|
-
def
|
115
|
+
# Validate a date time
|
116
|
+
def validate_value_date_time(value)
|
117
117
|
begin
|
118
118
|
DateTime.rfc3339(value)
|
119
119
|
rescue ArgumentError
|
120
|
-
raise SwaggerInvalidException.new("
|
120
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be a date time but is [#{value}]")
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
# Validate a string
|
125
|
-
def
|
124
|
+
# Validate a string
|
125
|
+
def validate_value_string(value)
|
126
126
|
if value
|
127
|
-
|
128
|
-
|
127
|
+
validate_value_string_length(value, PARAMS_MIN_LENGTH, '>=')
|
128
|
+
validate_value_string_length(value, PARAMS_MAX_LENGTH, '<=')
|
129
129
|
end
|
130
130
|
value
|
131
131
|
end
|
132
132
|
|
133
|
-
# Validate the length of a string
|
133
|
+
# Validate the length of a string
|
134
134
|
# @param value the value to check
|
135
135
|
# @param limit_param_name [Symbol] the param that contain the value to compare to
|
136
136
|
# @param limit_param_method [String] the comparison method to call
|
137
|
-
def
|
137
|
+
def validate_value_string_length(value, limit_param_name, limit_param_method)
|
138
138
|
if @params.key? limit_param_name
|
139
139
|
target_value = @params[limit_param_name]
|
140
140
|
unless value.length.send(limit_param_method, target_value)
|
141
|
-
raise SwaggerInvalidException.new("
|
141
|
+
raise SwaggerInvalidException.new("Value [#{name}] length should be #{limit_param_method} than #{target_value} but is #{value.length} for [#{value}]")
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|
@@ -154,7 +154,7 @@ module Sinatra
|
|
154
154
|
target_value = @params[limit_param_name]
|
155
155
|
method_to_call = @params[exclusive_limit_param_name] ? exclusive_limit_param_method : limit_param_method
|
156
156
|
unless value.send(method_to_call, target_value)
|
157
|
-
raise SwaggerInvalidException.new("
|
157
|
+
raise SwaggerInvalidException.new("Value [#{name}] should be #{method_to_call} than [#{target_value}] but is [#{value}]")
|
158
158
|
end
|
159
159
|
end
|
160
160
|
end
|