diff --git a/src/spec/Schema.php b/src/spec/Schema.php index 2145d23..998188f 100644 --- a/src/spec/Schema.php +++ b/src/spec/Schema.php @@ -128,8 +128,8 @@ protected function attributeDefaults(): array // return null as default when there is no type // return false as default when there is a type 'nullable' => $this->hasPropertyValue('type') ? false : null, - 'exclusiveMinimum' => $this->hasPropertyValue('minimum') ? false : null, - 'exclusiveMaximum' => $this->hasPropertyValue('maximum') ? false : null, + 'exclusiveMinimum' => null, + 'exclusiveMaximum' => null, ]; } diff --git a/tests/spec/SchemaTest.php b/tests/spec/SchemaTest.php index 2701694..be4cd6b 100644 --- a/tests/spec/SchemaTest.php +++ b/tests/spec/SchemaTest.php @@ -78,7 +78,7 @@ public function testMinMax() /** @var $schema Schema */ $schema = Reader::readFromJson('{"type": "integer", "minimum": 1}', Schema::class); $this->assertEquals(1, $schema->minimum); - $this->assertFalse($schema->exclusiveMinimum); + $this->assertNull($schema->exclusiveMinimum); $this->assertNull($schema->maximum); $this->assertNull($schema->exclusiveMaximum); @@ -92,7 +92,7 @@ public function testMinMax() /** @var $schema Schema */ $schema = Reader::readFromJson('{"type": "integer", "maximum": 10}', Schema::class); $this->assertEquals(10, $schema->maximum); - $this->assertFalse($schema->exclusiveMaximum); + $this->assertNull($schema->exclusiveMaximum); $this->assertNull($schema->minimum); $this->assertNull($schema->exclusiveMinimum);