News for hackers. Stuff that matters.
Re:Problems with Swagger by pbreit on Tuesday April 04, 2017 @04:42PM (#14036997)
Is whatever value people are getting out of client libraries provided by something generic like http://unirest.io ?

When does it make sense to issue API-specific client libraries for a plain ole RESTful API?

Re:Problems with Swagger by cookiecaper on Tuesday April 04, 2017 @06:26PM (#14037825)
All the time? Most "RESTful" (meaningless term, by the way) APIs have a series of convoluted steps that are annoying and tedious to hand-roll.

Authentication is a good basic example. Different APIs will have different requirements for authentication headers. Successful authentication frequently requires multiple steps, like an initial request to get a session token. Many APIs will also require your request to be signed according to their specifications, and to stuff that signature in a header with a special name.

Every API expects to receive data in its own format. I don't want to have to make a bunch of validators that lay on top of your data model. These can and should be provided, and Swagger makes that automatic.

As eropple states, if something is making me do all of that by hand, I'm already looking for something else that will allow me to just say "import project_lib; project_lib.authenticate(); ..."

If you're just talking about something that is read-only and that only emits a single field I care about, sure, no need for a library. Something like the free version of ipinfo.io would be a good example.

Stuff that's more complicated than that, yes, it needs a client library.

Re:Problems with Swagger by eropple on Tuesday April 04, 2017 @05:38PM (#14037457)
> When does it make sense to issue API-specific client libraries for a plain ole RESTful API?

Any time you have a statically-typed language consuming you. Having to write my own Jackson declarations to pull in your API to a JVM project or my own DataContract barf for a CLR one is a quick way to make me hate you, and me hating you means I'm already looking for an alternative that isn't you that gets out of my way.

Re:Problems with Swagger by pbreit on Tuesday April 04, 2017 @08:38PM (#14038663)
I sort of thought the opposite, that the client libraries are what is getting in the way.
Re:Problems with Swagger by eropple on Wednesday April 05, 2017 @04:18AM (#14040577)
So you enjoy writing a bunch of boilerplate class files that are manual translations of somebody else's doc?
Re:Problems with Swagger by pbreit on Wednesday April 05, 2017 @10:10AM (#14042172)
No, I just like to get started coding API calls.