4
votes

We are generating API documentation from the source code using Swagger. I am now wondering if there is any tool which automatically checks the compliance of the generated OpenAPI document (= Swagger JSON) to RESTful API design best practices.

For example Zalando has defined a publicly available guideline for REST-design In my opinion in these guideline there are many rules which can be check automatically based on the OpenAPI Specification:

  • “Don’t Break Backward Compatibility” could be check when OpenAPI documents of different versions are compared.
  • “Always Return JSON Object as Top-Level Data Structures to Support Extensibility"
  • “Keep URLs Verb-Free” could possible checked if compared with dictionaries.

So far, I only found tools which checks the completeness and naming conventions of an OpenAPI document. Does someone know a tool with more advanced rules?

UPDATE:

Meanwhile I have found a tool called Zally (https://github.com/zalando-incubator/zally). This tool checks for violations of Zalando's REST-Api Guidelines. It is rather easy to configure or extend.

1

1 Answers

1
votes

Some of these could be added as rules to openapilint. The backward compatibility check would need to compare two spec versions in search of differences, which is a bit more complex.