Correctly validate strings in the API.