/** @test */ public function itThrowAnExceptionOnUnsupportedCollectionFormat() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('unknown is not a supported query collection format'); $jsonSchema = $this->toObject(['type' => 'object', 'properties' => ['param' => ['type' => 'array', 'items' => ['string'], 'collectionFormat' => 'unknown']]]); QueryParamsNormalizer::normalize(['param' => 'foo%bar'], $jsonSchema); }
public function validateQueryParameters(RequestInterface $request, RequestDefinition $definition) { if ($definition->hasQueryParametersSchema()) { parse_str($request->getUri()->getQuery(), $queryParams); $schema = $definition->getQueryParametersSchema(); $queryParams = QueryParamsNormalizer::normalize($queryParams, $schema); $this->validate((object) $queryParams, $schema, 'query'); } }