diff --git a/CHANGELOG.md b/CHANGELOG.md index cbdb5a0e951..cc5fb988845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -113,10 +113,12 @@ * Identifiers: Do not denormalize the same identifier twice (#3762) * OpenAPI: Lazy load `SwaggerCommand` (#3802) * OpenAPI: Use Output class name instead of the Resource short name when available (#3741) +* OpenAPI: Allow unset PathItem method (#4107) * Router: Replace baseurl only once (#3776) * Mercure: Publisher bug fixes (#3790, #3739) * Serializer: Catch NotNormalizableValueException to UnexpectedValueEception with inputs (#3697) -* Doctrine: ODM escape search terms in RegexFilter +* Doctrine: Do not add JOINs for filters without a value (#3703) +* MongoDB: Escape search terms in `RegexFilter` (#3755) * Tests: Improve JSON Schema assertions (#3807, #3803, #3804, #3806, #3817, #3829, #3830) * Tests: Allow passing extra options in ApiTestClient (#3486) * Docs: Upgrade Swagger UI to version 3.37.2 (#3867) diff --git a/src/OpenApi/Model/Paths.php b/src/OpenApi/Model/Paths.php index 80829b3d876..8852f372feb 100644 --- a/src/OpenApi/Model/Paths.php +++ b/src/OpenApi/Model/Paths.php @@ -22,6 +22,11 @@ public function addPath(string $path, PathItem $pathItem) $this->paths[$path] = $pathItem; } + public function removePath(string $path): void + { + unset($this->paths[$path]); + } + public function getPath(string $path): ?PathItem { return $this->paths[$path] ?? null; diff --git a/tests/OpenApi/Factory/OpenApiFactoryTest.php b/tests/OpenApi/Factory/OpenApiFactoryTest.php index bd2ea6aed0c..3f2c4c42efc 100644 --- a/tests/OpenApi/Factory/OpenApiFactoryTest.php +++ b/tests/OpenApi/Factory/OpenApiFactoryTest.php @@ -762,4 +762,17 @@ public function testResetPathItem() $this->assertNull($pathItem->getPut()); $this->assertNull($pathItem->getPatch()); } + + public function testRemovePath() + { + $paths = new Model\Paths(); + + $paths->addPath('/', new PathItem()); + + $this->assertEquals(1, count($paths->getPaths())); + + $paths->removePath('/'); + + $this->assertEquals(0, count($paths->getPaths())); + } }