tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
573 stars 99 forks source link

Create OpenAPI spec for client generation #584

Open charlie-harvey opened 6 years ago

charlie-harvey commented 6 years ago

There are currently 3 clients for Collins - you have to roll your own even for Java.

If there was an OpenAPI document somewhere it could be used to generate clients in at least a dozen languages. Swagger Codegen being the example that would be most obvious.

defect commented 6 years ago

Hi, sorry for the super slow response.

Currently the Go and ruby clients cover 99% of our use cases at Tumblr (that last % being straight curl calls) so we haven't looked in to codegen things much. Not saying that we shouldn't, but time is limited :)

OpenAPI does looks pretty cool though. Do you think it would fit the collins API well, which can be kinda unorthodox here and there.

charlie-harvey commented 6 years ago

There are definitely unorthodox bits to the Collins API. The uninitiated might even call them frustrating. :) I recently wrote a java client that mimics the Asset and AssetType part of the Go Client. Don't need the rest as of now so I'll get to that later.

Apparently you can use the Swagger Editor and just write out your contract in YAML. They are trying to make it like Thrift/Protobuf. Write out your contract ahead of time and then generate the Server Stubs and Clients. It does work. But the process of writing out the contract is probably pretty time consuming.

But just think, then you can finally have that Ada client. And Eiffel. And Lua. Its all about Lua now.