Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/OpenApi/Model/Paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions tests/OpenApi/Factory/OpenApiFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
}