DEV Community

Hossain Khan
Hossain Khan

Posted on • Originally published at Medium on

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 medium.com , 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 https://github.com/amardeshbd/medium-api-specification

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.

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 http://swagger.io/open-source-integrations/).

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.

* validator-badge — online web-service to validate OpenAPI specification file

I hope somebody finds this useful for their project.

Oldest comments (0)