Introducing Style Validator to Ensure API Design Compliance

  March 14, 2017

Designing an API contract is no easy task. From the API’s initial plan, which includes its strategic and functional objectives, generating an API contract takes priority. Converting this plan into an actual human and machine readable API contract requires a lot of time and effort, especially given this will impact the future development and consumption of the API. Good Developer Experience (DX) has started to play a big role as a differentiating factor for users choosing and adopting APIs, and good DX starts with having consistency in design. But a consistent design isn’t just for improving the experience of users when consuming the API. It also ensures that your organization’s APIs are easier to maintain and manage now that a common standard has been established. It also allows teams to work better together around an accepted schema of API styles, allowing for faster development and reusability. Thus, to ensure consistency, reusability, maintainability and a great experience for developers trying to integrate and consume your API, a common standard of design needs to be ensured across all of your organization’s APIs. And this means that organizations not only need to set design standards, they also need a reliable way to enforce those standards and ensure that everyone working on the API understands these design requirements. Recognizing this need, the SwaggerHub team has developed a new Style Validator integration to ensure design standard compliance across all your organization’s APIs.

A Better Way to Ensure Good API Design

The Style Validator can be added to any API as an integration. For the unacquainted, integrations are custom add-ons that expand on your API’s functionality on SwaggerHub. The Style Validator integration can then be customized to suit your design standards. The Style Validator can be added to any API version, from the top right corner of the SwaggerHub Editor.

StyleValidator1

Learn how to use the Style Validator. The benefits of using the Style Validator are plentiful, and can have a direct, positive impact on your API’s development and consumption. Having the Style Validator can ensure your APIs:

Provide a Good Overview

Before your potential API consumers even start their journey learning how to write code against your API, they need to know what your API can offer. The Style Validator can ensure your API has the minimum high level information that gives end consumers a better understanding of what your API does. This information is defined by description, license and contact values of the API contract.

StyleValidator2

Are Designed for Faster Development

Different teams use different applications, technology stacks and toolsets to bring their API to life. This could be hooking the contract into a PhP package, connecting it to an API management platform or linking it to an implementation running behind the API. The Style Validator can validate for operationId, summary, description and tag in each operation to ensure that every operation has the right connection to the team’s toolset, as well as describes exactly what it’s supposed to do so different internal teams can gain visibility, understanding, and acceptance of the intended purpose of the operation.

StyleValidator3

The Validator can also ensure that your API development allows for better global reusability of common schema defined under the definitions tag, by only allowing global models and not local ones.

Are Easy to Understand

A well-designed API will tell the user exactly what parameters are required, and describe exactly what each response means. A great way to do this providing good descriptions and examples in the parameters and responses of various end points. The purpose of having examples is to provide the user an immediate, relatable reference on what sort of parameters they should input and the response packet they should ideally expect. You can ensure all model properties have examples to have your API contract designed for better understanding of the request-response cycle.

Are Easy to Learn

A well-designed API will be easy to work with, and its resources and associated operations can quickly be memorized by developers who work with it constantly. The quickest path to this is by having consistent naming of your paths, parameters, models and properties. With the Style Validator, you can see to it that your API nomenclature follows either “underscore_case” or “camelCase” to help your consumers easily adapt to working with your API.

Try the Style Validator Today

The Style Validator is a great way for organizations to ensure their teams are aligned on the accepted design standards, and the APIs are production ready. You can learn more about setting up the Style Validator here. If you have suggestions for any other integration or feature, please let us know here.   Log in now to try the Style Validator out for yourself.