Implement joi validation of query and path params. Fixes #936.

This implements the changes in #936.