News for hackers. Stuff that matters.
Re:Transit – A format for conveying values between different... by ochoa on Tuesday July 22, 2014 @02:37PM (#8070778)
Dumb question: why doesn't the value being a number tell us it's suppose to be a number?
Re:Transit – A format for conveying values between different... by michaelmior on Tuesday July 22, 2014 @02:47PM (#8070841)
Assuming the service is operating correctly, I think the more accurate statement is that it doesn't tell you the value will always be a number. That is, perhaps a field has multiple valid types. Maybe that field won't exist all the time or similar data may be available in a different struture. Without a schema, these questions can't really be answered.
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?