Travis CI script for your Swagger/OpenAPI Specification

Recently I have been working with swagger in a project. Swagger 2.0 has become open standard and now referred as OpenAPI Specification (OAS).

I also love, so when I saw their API doc was hand written in plain text, I thought it would be good exercise to convert it to OpenAPI Specification format. The result is

Now, recently I’ve started adding Travis Continuous Integration (CI) script for most of my recent projects. So, I wanted to add CI support for this OAS project.

UPDATE: I have written another article that leverages GitHub actions and node modules to validate different things. Use this article to validate anything including Swagger/OpenAPI specifications.

Adding Travis CI build support for OpenAPI specification

Googling for this specific topic didn’t bring much content. I wanted to keep the scrip simple and use existing validator provided by swagger-validator-badge web service (NOTE: There are over dozens of validator in different languages built by the community — see

Here are the key elements used for CI:

* shUnit2 — for writing unit tests in shell script. This is downloaded via Travis build config before the build begins.

.travis.yml — Travis CI build config

* validator-badge — online web-service to validate OpenAPI specification file — Shell script for unit test

I hope somebody finds this useful for their project.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store