File tree Expand file tree Collapse file tree
spec/support/examples/v3.1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ enum: array - in 3.0
4444const: any type - done
4545multipleOf: number - in 3.0
4646maximum: number - in 3.0
47- exclusiveMaximum: number - in 3.0
47+ exclusiveMaximum: number - done
4848minimum: number - in 3.0
49- exclusiveMinimum: number - in 3.0
49+ exclusiveMinimum: number - done
5050maxLength: integer >= 0 - in 3.0 (missing >= val)
5151minLength: integer >= 0 - in 3.0
5252pattern: string - in 3.0
Original file line number Diff line number Diff line change @@ -50,26 +50,16 @@ def multiple_of
5050 self [ "multipleOf" ]
5151 end
5252
53- # @return [Integer , nil]
53+ # @return [Numeric , nil]
5454 def maximum
5555 self [ "maximum" ]
5656 end
5757
58- # @return [Boolean]
59- def exclusive_maximum?
60- self [ "exclusiveMaximum" ]
61- end
62-
63- # @return [Integer, nil]
58+ # @return [Numeric, nil]
6459 def minimum
6560 self [ "minimum" ]
6661 end
6762
68- # @return [Boolean]
69- def exclusive_minimum?
70- self [ "exclusiveMinimum" ]
71- end
72-
7363 # @return [Integer, nil]
7464 def max_length
7565 self [ "maxLength" ]
Original file line number Diff line number Diff line change @@ -11,6 +11,16 @@ class V3_0 < Schema # rubocop:disable Naming/ClassAndModuleCamelCase
1111 def type
1212 self [ "type" ]
1313 end
14+
15+ # @return [Boolean]
16+ def exclusive_maximum?
17+ self [ "exclusiveMaximum" ]
18+ end
19+
20+ # @return [Boolean]
21+ def exclusive_minimum?
22+ self [ "exclusiveMinimum" ]
23+ end
1424 end
1525 end
1626 end
Original file line number Diff line number Diff line change @@ -25,6 +25,16 @@ def const
2525 self [ "const" ]
2626 end
2727
28+ # @return [Numeric]
29+ def exclusive_maximum
30+ self [ "exclusiveMaximum" ]
31+ end
32+
33+ # @return [Numeric]
34+ def exclusive_minimum
35+ self [ "exclusiveMinimum" ]
36+ end
37+
2838 # @return [Integer, nil]
2939 def max_contains
3040 self [ "maxContains" ]
Original file line number Diff line number Diff line change @@ -14,10 +14,8 @@ def self.included(base)
1414 base . field "title" , input_type : String
1515
1616 base . field "multipleOf" , input_type : Numeric
17- base . field "maximum" , input_type : Integer
18- base . field "exclusiveMaximum" , input_type : :boolean , default : false
19- base . field "minimum" , input_type : Integer
20- base . field "exclusiveMinimum" , input_type : :boolean , default : false
17+ base . field "maximum" , input_type : Numeric
18+ base . field "minimum" , input_type : Numeric
2119 base . field "maxLength" , input_type : Integer
2220 base . field "minLength" , input_type : Integer , default : 0
2321 base . field "pattern" , input_type : String
Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ class V3_0 < NodeFactory::Object # rubocop:disable Naming/ClassAndModuleCamelCas
1212 # OpenAPI 3.0 requires a type of String, whereas >= 3.1 is String or Array
1313 field "type" , input_type : String
1414
15+ # JSON Schema 2016 has these exclusive fields as booleans whereas
16+ # in JSON Schema 2021 (OpenAPI 3.1) these are numbers
17+ field "exclusiveMaximum" , input_type : :boolean , default : false
18+ field "exclusiveMinimum" , input_type : :boolean , default : false
19+
1520 validate :items_for_array
1621
1722 def build_node ( data , node_context )
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ class V3_1 < NodeFactory::Object # rubocop:disable Naming/ClassAndModuleCamelCas
2020 field "$ref" , input_type : String , factory : :ref_factory
2121 field "type" , factory : :type_factory , validate : :validate_type
2222 field "const"
23+ field "exclusiveMaximum" , input_type : Numeric
24+ field "exclusiveMinimum" , input_type : Numeric
2325 field "maxContains" , input_type : Integer
2426 field "minContains" , input_type : Integer , default : 1
2527 # dependentRequired - map with basic validation rules
Original file line number Diff line number Diff line change @@ -79,13 +79,13 @@ components:
7979 type : string
8080 exp :
8181 type : string
82- # Number:
83- # type: integer
84- # multipleOf: 5
85- # maximum: 110
86- # exclusiveMaximum: 111
87- # minimum: 10
88- # exclusiveMinimum: 9
82+ Number :
83+ type : integer
84+ multipleOf : 5
85+ maximum : 110
86+ exclusiveMaximum : 111
87+ minimum : 10
88+ exclusiveMinimum : 9
8989 String :
9090 type : string
9191 maxLength : 10
You can’t perform that action at this time.
0 commit comments