protected function materializeResource(Resource $resource)
    {
        foreach ($resource as $method) {
            $request = $method->getRequest();
            if ($request) {
                $method->setRequest(new Schema($request->getDefinition()));
            }

            $responses = $method->getResponses();
            foreach ($responses as $statusCode => $response) {
                $method->addResponse($statusCode, new Schema($response->getDefinition()));
            }
        }
    }