I suspect this is custom validation used across many API endpoints, but I specifically refer to the People Memberships endpoint (i.e. PUT to /people/:person_id/memberships) The validator rejects null values for expires_on, and will only accept strings. If we want to set expires_on to null, we must send it a non-date string. The API will reject "expires_on": null with an error, but will return "expires_on": null if the attribute sent is "expires_on": "". Further, the validator does not catch non-date strings. Sending "expires_on": "donuts" also results in the response "expires_on": null. Really, the output should match the input, and the date validator should check to see whether the attribute sent matches a valid value (i.e. ISO8601 date or null). Instead, the validator only rejects null values and the API translates any non-ISO8601 string to null.
Submitted
Official response from Farz SokhansanjJeremy,
You are right about the "donut" example but I can't replicate the other validation error. When I make the request and set "expires_on" to null I'm returning a 200 with the response body including "expires_on": null.
Please let me know if I'm misunderstanding the error or how you submitted the request to get the validation error.
Showing 2 reactions
Sign in with