@@ -66,6 +66,44 @@ public function testNullable()
66
66
$ this ->assertNull ($ schema ->nullable );
67
67
}
68
68
69
+ public function testMinMax ()
70
+ {
71
+ /** @var $schema Schema */
72
+ $ schema = Reader::readFromJson ('{"type": "integer"} ' , Schema::class);
73
+ $ this ->assertNull ($ schema ->minimum );
74
+ $ this ->assertNull ($ schema ->exclusiveMinimum );
75
+ $ this ->assertNull ($ schema ->maximum );
76
+ $ this ->assertNull ($ schema ->exclusiveMaximum );
77
+
78
+ /** @var $schema Schema */
79
+ $ schema = Reader::readFromJson ('{"type": "integer", "minimum": 1} ' , Schema::class);
80
+ $ this ->assertEquals (1 , $ schema ->minimum );
81
+ $ this ->assertFalse ($ schema ->exclusiveMinimum );
82
+ $ this ->assertNull ($ schema ->maximum );
83
+ $ this ->assertNull ($ schema ->exclusiveMaximum );
84
+
85
+ /** @var $schema Schema */
86
+ $ schema = Reader::readFromJson ('{"type": "integer", "minimum": 1, "exclusiveMinimum": true} ' , Schema::class);
87
+ $ this ->assertEquals (1 , $ schema ->minimum );
88
+ $ this ->assertTrue ($ schema ->exclusiveMinimum );
89
+ $ this ->assertNull ($ schema ->maximum );
90
+ $ this ->assertNull ($ schema ->exclusiveMaximum );
91
+
92
+ /** @var $schema Schema */
93
+ $ schema = Reader::readFromJson ('{"type": "integer", "maximum": 10} ' , Schema::class);
94
+ $ this ->assertEquals (10 , $ schema ->maximum );
95
+ $ this ->assertFalse ($ schema ->exclusiveMaximum );
96
+ $ this ->assertNull ($ schema ->minimum );
97
+ $ this ->assertNull ($ schema ->exclusiveMinimum );
98
+
99
+ /** @var $schema Schema */
100
+ $ schema = Reader::readFromJson ('{"type": "integer", "maximum": 10, "exclusiveMaximum": true} ' , Schema::class);
101
+ $ this ->assertEquals (10 , $ schema ->maximum );
102
+ $ this ->assertTrue ($ schema ->exclusiveMaximum );
103
+ $ this ->assertNull ($ schema ->minimum );
104
+ $ this ->assertNull ($ schema ->exclusiveMinimum );
105
+ }
106
+
69
107
public function testReadObject ()
70
108
{
71
109
/** @var $schema Schema */
@@ -111,6 +149,10 @@ public function testReadObject()
111
149
$ this ->assertFalse ($ schema ->writeOnly );
112
150
// deprecated Default value is false.
113
151
$ this ->assertFalse ($ schema ->deprecated );
152
+ // exclusiveMinimum Default value is null when no minimum is specified.
153
+ $ this ->assertNull ($ schema ->exclusiveMinimum );
154
+ // exclusiveMaximum Default value is null when no maximum is specified.
155
+ $ this ->assertNull ($ schema ->exclusiveMaximum );
114
156
}
115
157
116
158
public function testDiscriminator ()
@@ -267,9 +309,9 @@ public function testSchemaProperties()
267
309
'title ' => null ,
268
310
'multipleOf ' => null ,
269
311
'maximum ' => null ,
270
- 'exclusiveMaximum ' => false ,
312
+ 'exclusiveMaximum ' => null ,
271
313
'minimum ' => null ,
272
- 'exclusiveMinimum ' => false ,
314
+ 'exclusiveMinimum ' => null ,
273
315
'maxLength ' => null ,
274
316
'minLength ' => null ,
275
317
'pattern ' => null ,
0 commit comments