Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Open API Initiative (openapis.org)
80 points by xrorre on March 11, 2016 | hide | past | favorite | 21 comments


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.


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


There does appear to be an examples section in the project repository

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


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.


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/


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.



Very nice! I particularly like the ability to compare two different versions visually.


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.


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.


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.


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.


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.


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...


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.


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.


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.


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.


Is there a directory of apis that conform to the spec?


Yes! Over 200 specs are provided for free by APIs.guru:

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


How's this related to WSDL?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: