Chicago / lead-safe-api-docs

http://dev.cityofchicago.org/docs/lead-safe/
1 stars 1 forks source link

EDD returning 400 error if empty string #43

Closed tomschenkjr closed 6 years ago

tomschenkjr commented 6 years ago

We received this note from @AOCjcarr:

It appears that the code is only working if the EDD is sent.. If no EDD is sent, we are getting an error, with the EDD I do see a score coming back. Currently when no EDD I am returning a blank field "expected_due_date": "", and receiving this error. \"errors\": [[400, \"Incorrect date format\"]] Is there a different value that should be sent to designate no EDD, especially for children?

Per v1.0.0-rc.3, expected_due_date is an optional field, so this is unexpected behavior.

@geneorama - do you see anything immediately at issue? Should the field be removed outright instead of an empty string, ""?

geneorama commented 6 years ago

Yes, expected_due_date is an optional field, and the API works if the field is omitted. However, if the field is present it needs to be a valid date, otherwise the date cannot be parsed and an error is generated. So providing things like this: "" "NA" NA NULL "NULL" will produce an error because the field is present, but it's not a valid date.

Is this something we should change or better document?

geneorama commented 6 years ago

I'm closing this for now. The API is working as we expected, and @AOCjcarr is working on logic on their side to handle conditionally passing this field to the API.

We could re-open as a feature request if there is in fact a feature request.