News for hackers. Stuff that matters.
Re:Transit – A format for conveying values between different... by kalleboo on Wednesday July 23, 2014 @12:47AM (#8072950)
Example: Postal codes. Say you're transferring an address in JSON and you have a postal code field. In the UK, postal codes are strings (e.g. "BS42BG"), easy enough. Now, someone enters a US postal code (90505). Should we transfer it as a number, or a string?
Re:Transit – A format for conveying values between different... by elros on Wednesday July 23, 2014 @04:57AM (#8073419)
Definitely as a string. Numbers aren't things that have digits. Numbers are things you do math with.
Re:Transit – A format for conveying values between different... by kalleboo on Wednesday July 23, 2014 @08:39AM (#8074008)
OK, that's logical. So where do we specify this without a schema? What happens if a client sends a number instead of a string to the server? Should it accept it and convert it, or return an error?