Swagger: A Roundtrip Tool For Creating And Consuming REST APIs

Home » Blog » Software » Enterprise Software » Swagger: A Roundtrip Tool For Creating And Consuming REST APIs

In this second part of my series on useful tools for developing CRUD applications I’d like to introduce Swagger and Swagger Codegen in particular. Introduce perhaps isn’t exactly the right word because first of all Swagger is quite well known in developer circles these days. Secondly, a few months ago I wrote a blog post about how to use Swagger to generate client SDKs for REST APIs.

Swagger – originally having originated at Wordnik is a tool for documenting and publishing their own dictionary API – today essentially is a tool suite covering various aspects of REST APIs and API definition and documentation in particular. In March 2015 the open source project was acquired by API testing and development tools provider SmartBear (of SoapUI fame). SmartBear continue to develop Swagger and have since started the Open API Initiative (OAI), which now includes big players like Google, Microsoft, PayPal and IBM. The purpose of this initiative is to provide a standardised way for describing REST APIs in a vendor-independent manner. The Swagger Specification donated by SmartBear serves as the foundation for this endeavour.

Among various accompanying and libraries for countless languages and frameworks Swagger itself consists of these 3 core tools:

  • Swagger Editor: An IDE for describing your API in a JSON format. Once your API description is done you can directly generate server code for this API from the IDE!
  • Swagger Codegen: As mentioned earlier Swagger Codegen can be used to generate client SDKs for accessing Swagger-defined REST APIs. Supporting a wide variety of languages (currently more than 20) all the Swagger Codegen command-line tool needs is a Swagger API definition in order to generate client code for consuming your REST API.
  • Swagger UI: The probably most well-known tool from the Swagger toolbox. Swagger UI automatically creates an interactive HTML documentation from Swagger API definitions. Not only does Swagger UI provide you with a more or less effortless way of supplying documentation for your APIs but it also lets your users call and explore these APIs directly from the browser. No complex and tedious curl calls required anymore!

Swagger is conducive to building CRUD applications because it makes describing and provide access to data models a breeze. For vanilla CRUD applications that need just that and no extra business logic Swagger and its supplementary libraries probably are entirely sufficient and you quite likely won’t even have to write a single line of code (apart from the Swagger API definition that is)!

Leave a Comment

* Checkbox GDPR is required

*

I agree

By continuing to browse the site you agree to our use of cookies. Privacy Policy

Privacy Preference Center

Strictly necessary

These cookies are necessary for the site to function.

PHPSESSID: Preserves user session state across page requests.

__cfduid: Used by the content network, Cloudflare, to identify trusted web traffic.

PHPSESSID
__cfduid

Preferences

Remembers the user's submitted data when a comment is submitted in a blog post. The purpose is to aut o-populate form fields for subsequent comments, in order to save time for the user.

wfvt_#

Statistics

Statistic cookies help us to understand how visitors interact with our websites by collecting and reporting information anonymously.

_ga: Registers a unique ID that is used to generate statistical data on how the visitor uses the website.

_gat: Used by Google Analytics to throttle request rate.

_gid: Registers a unique ID that is used to generate statistical data on how the visitor uses the website.

collect: Used to send data to Google Analytics about the visitor's device and behaviour. Tracks the visitor across d evices and marketing channels.

_ga,_gat,_gid
collect

Security

We use Wordfence to secure our website against hacking attempts: https://www.wordfence.com/

wordfence_verifiedHuman

Close your account?

Your account will be closed and all data will be permanently deleted and cannot be recovered. Are you sure?