Do we really need a separate E_INVALID_FIELD_TYPE error code?  Why not
just fold it into E_MISSING_FIELD, by defining that as "The field is
missing or it has the wrong type."

First reason it's unnecessary: if the protocol says the client must
provide a String field named "cost-type", and the client defines
"cost-type" as an array, well, the STRING field is missing, isn't it?

Second reason: JSON libraries rarely distinguish between "missing" and
"wrong type". Eg, getString("foo") usually returns null if "foo" doesn't
exist or if it exists but isn't a string. The server has to do additional
analysis to distinguish between the two cases.


Third reason: Does distinguishing "missing" from "wrong type" really help
the client? Fundamentally its the same error. The client programer will
check the definition of the field and will figure it out pretty quickly.

        - Wendy Roome


_______________________________________________
alto mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/alto

Reply via email to