Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/Metadata/UriVariablesConverterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace ApiPlatform\Metadata;

use ApiPlatform\Metadata\Exception\InvalidIdentifierException;
use ApiPlatform\Metadata\Exception\InvalidUriVariableException;

/**
* Identifier converter.
Expand All @@ -29,6 +30,7 @@ interface UriVariablesConverterInterface
* @param string $class The class to which the URI variables belong to
*
* @throws InvalidIdentifierException
* @throws InvalidUriVariableException
*
* @return array Array indexed by identifiers properties with their values denormalized
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Routing/IriConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use ApiPlatform\Metadata\CollectionOperationInterface;
use ApiPlatform\Metadata\Exception\InvalidArgumentException;
use ApiPlatform\Metadata\Exception\InvalidIdentifierException;
use ApiPlatform\Metadata\Exception\InvalidUriVariableException;
use ApiPlatform\Metadata\Exception\ItemNotFoundException;
use ApiPlatform\Metadata\Exception\OperationNotFoundException;
use ApiPlatform\Metadata\Exception\RuntimeException;
Expand Down Expand Up @@ -99,7 +100,7 @@ public function getResourceFromIri(string $iri, array $context = [], ?Operation

try {
$uriVariables = $this->getOperationUriVariables($operation, $parameters, $attributes['resource_class']);
} catch (InvalidIdentifierException $e) {
} catch (InvalidIdentifierException|InvalidUriVariableException $e) {
throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Issues/Issue7135Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function testInvalidPostRequestWithIriWhenIdentifierIsUuid(): void
]);

self::assertEquals(400, $response->getStatusCode());
self::assertJsonContains(['detail' => 'Identifier "id" could not be transformed.']);
self::assertJsonContains(['detail' => 'Invalid IRI "pull-request-7135/bar/invalid-uuid".']);
}

public function testInvalidGetRequestWhenIdentifierIsUuid(): void
Expand Down
Loading