News for hackers. Stuff that matters.
Re:Robust APIs Are Weird by jbverschoor on Saturday June 20, 2020 @05:00AM (#23582751)
>> Be conservative in what you send, be liberal in what you accept.

Oh no... be very strict in what you accept. Once out there, you can't make it more strict. APIs should be as strict and defined as possible. Unless the API is not an API, but user input, then, yes, be liberal in what you accept

Re:Robust APIs Are Weird by saurik on Saturday June 20, 2020 @05:59AM (#23582972)
Yeah: exactly. Postel has even gone on the record to note how he is being misinterpreted a lot and what he meant was more like "to maximize ecosystem rebustness, make sure to accept as much of the specification as possible including all the optional parts for the things you accept, but prefer to only require and use the common subset of required and generally well implemented functionality for the things you send".
Re:Robust APIs Are Weird by CodesInChaos on Saturday June 20, 2020 @08:13AM (#23583509)
From what I remember his example was a reserved field which you must set to 0 when writing, and ignore while reading to enable extensibility.

In a modern context this would correspond to ignoring unknown keys in json, or ignoring unknown fields in protobuf.

Sadly many interpret this as accepting an ill defined superset of the specification, which then turns into a complex specification as implementations rely on those extensions being handled in a specific way.

Re:Robust APIs Are Weird by lloydatkinson on Saturday June 20, 2020 @09:07AM (#23583728)
100% agreed. Always laughed (but also silently angry) when I hear people spout this meme. Be strict in what you accept and be strict in what you return. That's what a contract is.