@@ 58-65 (lines=8) @@ | ||
55 | * |
|
56 | * @return ValidationResult |
|
57 | */ |
|
58 | public function validateRequest(ServerRequestInterface $request, string $path): ValidationResult |
|
59 | { |
|
60 | $operation = $this->description->getPath($path)->getOperation($request->getMethod()); |
|
61 | $schema = $operation->getRequestSchema(); |
|
62 | $requestParameters = $this->parameterAssembler->getRequestParameters($request, $operation); |
|
63 | ||
64 | return $this->validator->validate($schema, $requestParameters); |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * @param array|object $body |
|
@@ 75-88 (lines=14) @@ | ||
72 | * |
|
73 | * @return ValidationResult |
|
74 | */ |
|
75 | public function validateResponse( |
|
76 | $body, |
|
77 | ServerRequestInterface $request, |
|
78 | ResponseInterface $response, |
|
79 | string $path |
|
80 | ): ValidationResult { |
|
81 | ||
82 | ||
83 | ||
84 | $operation = $this->description->getPath($path)->getOperation($request->getMethod()); |
|
85 | $schema = $operation->getResponse($response->getStatusCode())->getSchema(); |
|
86 | ||
87 | return $this->validator->validate($schema, $body); |
|
88 | } |
|
89 | } |
|
90 |