This episode is another one of “it didn’t work out as planned.” I originally wanted to use Abao as a tool for testing my API implementation against the RAML description. Unfortunately, Abao only works with RAMl 0.8 and not with RAML 1.0 which I was using. The request ticket for RAML 1.0 support was opened in 2015 and is still not done.
I implemented a basic version of the TaskService today. You can find the full version in the GitHub repo as I’ll only discuss certain findings.
Now that we have settled with a DB, it is time to define our model.
Today, we are going to decide which data storage we will use. A few years ago, it was pretty clear to go with an RDBMS, but nowadays we have a few other options we can consider. If we have a choice at all. In the enterprise world, we are often restricted by some company policies or standards.
Now that we have defined our API in RAML and generated the Spring MVC controllers, etc. it is implementation time. Before we write our code, we should consider if we go with a classic 3 tier design or skip some of them.
Last time I wrote the RAML spec for the Kanban API and now we are going to generate some Spring MVC controller for it. So, I setup a Spring Boot project on GitHub and used the Spring MVC - RAML Spec Synchroniser Plugin for Maven.
Now that we have covered the essentials, we could go and hack our MVP together. However, we will look at other options first.
The next thing we should consider in building our API is a versioning scheme. It is inevitable that we are going to change an API and at some point will face backward-incompatible changes. You might ignore it if you only have one client. But trust me, if you don’t consider it from the start, it will ruin your day in the future.
Now that we have settled on using REST, we face the next decision with naming our endpoints. It seems easy, but I’ve found three way so far, and I believe all claim to be best practice. Which I find funny.