News for hackers. Stuff that matters.
Re:The Open API Initiative by whatnotests on Friday March 11, 2016 @04:00PM (#11269487)
What most API documentation lacks is one thing.

Examples.

Real, working, copy-n-paste examples.

While I prefer the swagger format, we use Blueprint at work because it's trivial to include an actual example request or response as part of the documentation.

Sure, schema helps, but having a spot to just lay out an example request or response is really important.

Another thing: often, one must perform prerequisite steps before making a call to a given API method. Eg - you must have booked a flight before checking in. The context surrounding how an API fits into its use-cases is as important as the API itself.

Re:The Open API Initiative by bbrennan on Saturday March 12, 2016 @01:00AM (#11271588)
Having a machine readable spec is important for driving examples though. For instance, at LucyBot we use OpenAPI to drive Recipes - tutorials for using an API to achieve a specific use case. Each recipe provides working sample code in a few different languages. You can see examples for Kaltura's video API at developer.kaltura.org
Re:The Open API Initiative by porpoisemonkey on Friday March 11, 2016 @05:59PM (#11270163)
There does appear to be an examples section in the project repository

https://github.com/OAI/OpenAPI-Specification/tree/master/exa...

Re:The Open API Initiative by palakchokshi on Friday March 11, 2016 @06:48PM (#11270455)
I believe he meant a way to put examples in the spec itself. I believe they have a client SDK that will consume the API spec and allow you to make requests and see responses.
Re:The Open API Initiative by porpoisemonkey on Friday March 11, 2016 @07:26PM (#11270606)
Ah I see. The OpenAPI specification for the interface description language and the auto-generation tools are actually two separate entities so I'm not sure it would make sense that they put examples for a specific auto-generation tool in the official OpenAPI repository.

It seems like the best supported tool for generating client and server stubs is Swagger Codegen. Version 2.1.2 seems to support the OpenAPI 2.0 draft spec.

http://swagger.io/swagger-codegen/

http://swagger.io/getting-started/

Re:The Open API Initiative by whatnotests on Saturday March 12, 2016 @01:08AM (#11271604)
Yes, I mean documentation in general.

It's fine to just show a long list of method signatures and class hierarchies, but a working code sample is the picture that's worth a thousand words.

Re:The Open API Initiative by progx on Saturday March 12, 2016 @05:08AM (#11272215)
Re:The Open API Initiative by whatnotests on Saturday March 12, 2016 @05:44PM (#11275048)
Very nice! I particularly like the ability to compare two different versions visually.
Re:The Open API Initiative by palakchokshi on Friday March 11, 2016 @03:37PM (#11269306)
Next will come the API spec parsers to automate client code generation. Those will break on the first vendor specific extension. Vendors will put in extensions for security, pre and post request action guidance, etc. This will cause vendor specific client code generators to be created. The specification will take a long time to get updated as each vendor will want their extensions in the core specification. As a result even more extensions will be created.

We have seen this cycle before with WSDL and XML Schema, etc. I hope we have learned from our mistakes and don't go down the same path to have history repeat itself.

Personally I like the idea of an API Specification but the practical use has been a let down so far.

Re:The Open API Initiative by doublerebel on Friday March 11, 2016 @04:45PM (#11269779)
Auto-generated client side consumers for APIs already exist, and are quite useful: https://apimatic.io .

If we can get producers to standardize all or part of their API, then we gain the ability to switch easily between providers and force them to compete on service instead of proprietary lock-in.

Ideally.

Re:The Open API Initiative by sinzone on Friday March 11, 2016 @11:17PM (#11271376)
Already happening. Tools (like https://gelato.io) provide auto-generated docs, live test-console, code snippets and SDKs from your Swagger file. It comes with a free plan for OSS projects.
Re:The Open API Initiative by Mikhail_Edoshin on Saturday March 12, 2016 @11:11AM (#11273327)
I'm not sure about WSDL, the only thing I understand about it is that it was originally viewed as a simplified version of CORBA for Web :) But did XML Schema actually had that cycle of incompatible extensions you describe? I agree it's a bit heavyweight, but otherwise its concept is pretty clear and solid. To me HTML and CSS look more like vendor extension soup you describe.

That said, there certainly will be extensions, because REST as it is is not sufficient for many scenarios. Take WebDAV, for instance: it has locks, batch updates, queries, standard support for sync, etc. REST has nothing of this sort. Have you ever tried to sync a large dataset against a typical REST API? It's very painful. While REST is simple, this simplicity mostly comes from being very basic. And WSDL and XML Schema are complex not because their authors are stupid (addition: or because there was some political wars), but because the subject itself is complex.

Re:The Open API Initiative by Oras on Friday March 11, 2016 @05:44AM (#11265815)
In this page: https://github.com/OAI/OpenAPI-Specification/tree/OpenAPI.ne... The link to current specification is broken

Review the [current specification]. The human-readable markdown file is the source of truth for the specification.

Re:The Open API Initiative by porpoisemonkey on Friday March 11, 2016 @06:01PM (#11270172)
Noticed the same thing. After some digging I found what appears to be the latest draft spec here: https://github.com/OAI/OpenAPI-Specification/blob/master/ver...
Re:The Open API Initiative by yeukhon on Friday March 11, 2016 @06:15PM (#11270267)
The real major Open API I always think is required is an Open API allow me to interact with any part of a website so people can finally build assistive technology based on API rather than parsing some website's DOM that you will likely never be able to parse out correctly from version to version. If the website exposes a "REST" specification how to interact with the pages, then we can really build a website visual impaired can finally used. Just my rant after trying to build one and realized how crazy it was to learn to work with DOM.
Re:The Open API Initiative by palakchokshi on Friday March 11, 2016 @06:47PM (#11270444)
What you are looking for is the semantic web or an accessible web. There are standards to create an accessible website but few developers do it unless their market has a significant number of visually impaired people. This is further complicated by Single Page Applications and/or web apps. If there was a browser extension or something that made every website accessible that would be an awesome extension.
Re:The Open API Initiative by malandrew on Sunday March 13, 2016 @01:56AM (#11276559)
Too little, too late.

Thrift, gRPC, YaRPC, etc. are all RPC frameworks with strong typing and binary transports. They are still immature, but as such frameworks mature and support more languages, they will eat the lunch of any project trying to build on REST.

Re:The Open API Initiative by JimDabell on Saturday March 12, 2016 @06:22AM (#11272397)
Does anybody have any recommendations for a Swagger-style documentation toolchain for REST APIs? I mean actual REST, not this weird anti-REST where you predefine fixed URI structures up front.

REST APIs are based around media types, not URI structures. Unfortunately, tools like Swagger are based around URI structures, which shouldn't be in REST API documentation at all. It makes trying to find good tooling for REST APIs difficult when people say "just use Swagger" and similar.

Re:The Open API Initiative by sharemywin on Friday March 11, 2016 @08:17AM (#11266393)
Is there a directory of apis that conform to the spec?
Re:The Open API Initiative by bbrennan on Saturday March 12, 2016 @01:03AM (#11271595)
Yes! Over 200 specs are provided for free by APIs.guru:

https://github.com/apis-guru/api-models

Re:The Open API Initiative by gtirloni on Friday March 11, 2016 @03:13PM (#11269160)
How's this related to WSDL?