So, I see this notice in my plugin : Notice: register_rest_route was called incorrectly. Namespace must not start or end with a slash.
The point to note is that my namespace is myplugin/v1 and does not start or end with a slash.
I also confirmed with by adding a print_r($namespace); and die();
Someone just put a wrong error message or is there some real problem in my code. Please help me out.