{"id":2930,"date":"2018-03-30T05:03:52","date_gmt":"2018-03-30T11:03:52","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=2930"},"modified":"2018-03-30T05:03:52","modified_gmt":"2018-03-30T11:03:52","slug":"swagger-looks-pretty-good-from-here","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/2930","title":{"rendered":"Swagger looks pretty good from here"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-medium wp-image-2931\" src=\"http:\/\/www.mooreds.com\/wordpress\/wp-content\/uploads\/2018\/03\/swagger-1565642_640-212x300.jpg\" alt=\"Swagger\" width=\"212\" height=\"300\" srcset=\"http:\/\/edit.mooreds.com\/wordpress\/wp-content\/uploads\/2018\/03\/swagger-1565642_640-212x300.jpg 212w, http:\/\/edit.mooreds.com\/wordpress\/wp-content\/uploads\/2018\/03\/swagger-1565642_640.jpg 453w\" sizes=\"auto, (max-width: 212px) 100vw, 212px\" \/>A few years ago I was working on an API that my client was going to make available to some of their clients. I used <a href=\"https:\/\/swagger.io\/\">Swagger<\/a>, which I&#8217;d heard about from a <a href=\"http:\/\/gluecon.com\/\">Gluecon<\/a> presentation.<\/p>\n<p>I was <strong>unimpressed<\/strong>. I recall having difficulty getting the online tool to work and the documentation generated was poor. This could very well have been user error or my misunderstanding of the sweet spot of the tool, but for whatever reason it wasn&#8217;t a fit for the problem.<\/p>\n<p>Fast forward a few years and I was talking to a company about a position. They were planning to use Swagger to generate their API SDKs. They had an API which was crucial to their business and were currently supporting a large number of SDKs on a bespoke basis. I reviewed the documentation of Swagger and downloaded the 2.3 version. I was very quickly able to generate a number of client and server stubs using the <a href=\"https:\/\/swagger.io\/docs\/swagger-tools\/#installation-11\">codegen project<\/a>. They have a long list of supported languages, but I quickly generated ruby, csharp and perl client bindings and a simple rails5 and spring server. I didn&#8217;t push these through to production and I&#8217;m sure that if I had I&#8217;d have learned about the rough edges (it&#8217;s always nice to check out Stack Overflow for rough edges for any technology&#8211;here&#8217;s <a href=\"https:\/\/stackoverflow.com\/questions\/tagged\/swagger\">questions for swagger<\/a>). Regardless, the ability to take a simple JSON configuration file and create API front ends and backends in minutes was quite impressive.<\/p>\n<p>Note that the codegen tools are all in java, so if leveraging that technology gives you the willies, you might want to look around for another solution. Note also that Swagger has now been moved to the <a href=\"https:\/\/github.com\/OAI\/OpenAPI-Specification\">OpenAPI project<\/a> (as of version 2.0 of Swagger). If you want to know more about that, here&#8217;s the blog post <a href=\"https:\/\/swagger.io\/blog\/introducing-the-open-api-initiative\/\">announcing that move<\/a>. Here&#8217;s a look at <a href=\"https:\/\/blog.readme.io\/an-example-filled-guide-to-swagger-3-2\/\">features of the next version<\/a>.<\/p>\n<p>If you are developing an API first company (and there are <a href=\"https:\/\/thenewkingmakers.com\/\">good reasons<\/a> to be that), I&#8217;d recommend taking a long hard look at Swagger. The speed of adding SDK support as well as the community around this tooling look to be huge advantages.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few years ago I was working on an API that my client was going to make available to some of their clients. I used Swagger, which I&#8217;d heard about [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62],"tags":[],"class_list":["post-2930","post","type-post","status-publish","format-standard","hentry","category-apis"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2930"}],"version-history":[{"count":2,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2930\/revisions"}],"predecessor-version":[{"id":2933,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2930\/revisions\/2933"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}