diff --git a/src/Lib/Schema/SchemaFactory.php b/src/Lib/Schema/SchemaFactory.php index f53ec576..7af21d2b 100644 --- a/src/Lib/Schema/SchemaFactory.php +++ b/src/Lib/Schema/SchemaFactory.php @@ -134,7 +134,9 @@ private function getProperties(Model $model, int $propertyType, ?DocBlock $docBl $factory = new SchemaPropertyFactory($this->validator, $docBlock); foreach ($model->getProperties() as $property) { - $return[$property->getName()] = $factory->create($property); + if (!$property->isHidden()) { + $return[$property->getName()] = $factory->create($property); + } } $return = array_merge($return, $this->getPropertyAnnotations($model)); diff --git a/tests/TestCase/Lib/SwaggerSchemaTest.php b/tests/TestCase/Lib/SwaggerSchemaTest.php index 8f8f5050..cfb1838a 100644 --- a/tests/TestCase/Lib/SwaggerSchemaTest.php +++ b/tests/TestCase/Lib/SwaggerSchemaTest.php @@ -70,7 +70,7 @@ public function test_employee_table_properties(): void $this->assertEquals('date', $employee['properties']['hire_date']['format']); $this->assertTrue($employee['properties']['read']['readOnly']); - $this->assertTrue($employee['properties']['write']['writeOnly']); + $this->assertArrayNotHasKey('write', $employee['properties']); $this->assertArrayNotHasKey('hide', $employee['properties']); foreach (['birth_date', 'first_name', 'last_name', 'gender', 'hire_date',] as $property) {