Added some more validation in the construction of a URI template so that one can't generate an invalid URI.