Correct logic for parameter validation in a more readable way.

Fixes validation issues introduced by ec5a89a10ea2d4e65c0213854efba05abd075d47.

First, the parameter itself must be valid for that endpoint. Second, if that parameter has a set number of valid values, the passed-in value needs to be validated.