/** * @test * @expectedException \KleijnWeb\SwaggerBundle\Exception\InvalidParametersException */ public function cannotOmitBodyWhenExplicitlyMarkedAsRequired() { $request = new Request(); $operationDefinition = ['parameters' => [['name' => 'foo', 'required' => true, 'in' => 'query', 'type' => 'int']]]; $validator = new RequestValidator($operationDefinition); $validator->validateRequest($request); }
/** * @param Request $request * @param array $operationDefinition * * @throws InvalidParametersException * @throws MalformedContentException * @throws UnsupportedContentTypeException */ public function process(Request $request, array $operationDefinition) { $this->coercer->coerceRequest($request, $operationDefinition); $this->validator->setOperationDefinition($operationDefinition); $this->validator->validateRequest($request); }