@@ -66,6 +66,44 @@ public function testNullable()
6666 $ this ->assertNull ($ schema ->nullable );
6767 }
6868
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+
69107 public function testReadObject ()
70108 {
71109 /** @var $schema Schema */
@@ -111,6 +149,10 @@ public function testReadObject()
111149 $ this ->assertFalse ($ schema ->writeOnly );
112150 // deprecated Default value is false.
113151 $ 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 );
114156 }
115157
116158 public function testDiscriminator ()
@@ -267,9 +309,9 @@ public function testSchemaProperties()
267309 'title ' => null ,
268310 'multipleOf ' => null ,
269311 'maximum ' => null ,
270- 'exclusiveMaximum ' => false ,
312+ 'exclusiveMaximum ' => null ,
271313 'minimum ' => null ,
272- 'exclusiveMinimum ' => false ,
314+ 'exclusiveMinimum ' => null ,
273315 'maxLength ' => null ,
274316 'minLength ' => null ,
275317 'pattern ' => null ,
0 commit comments