REST API design guidelines compliance test

930 views Asked by At

Given a formal specification of a REST interface - such a Swagger 2.0 file - I would like to test it at design time against a set of simple pre-defined design guidelines for the interface itself. The guidelines are composed by mandatory (MUST) and non-mandatory (SHOULD, COULD) statements, of which only the MUSTs need to be enforced.

Facts:

  • people writing the APIs and the corresponding Swagger files are not REST experts, and altough they are supposed to apply the above-mentioned design rules they won't do it - not completely, at least
  • lots of Swagger files, so I need an automatic tool for this purpose. No preference for any technology or programming language
  • validation rules might change in the future

Examples:

Rule to be enforced: no URI of a REST API must contain the word "process"

Test Case n.1

# YAML Swagger to be tested
[...]
paths:
   /process_user/{userId}:
       [...]

# --> Outcome of test against rule: failed

Test Case n.2

# YAML Swagger n.2 to be tested**:
[...]
paths:
   /user/{userId}:
       [...]

# Outcome of test against rule**: passed

Do you know of any tool allowing to do the job?

1

There are 1 answers

0
csparpa On

Posting this for convenience of the Community: user Samuel_vdc found an interesting project by Zalando called Zally, which is an "API Linter" and at current state of art validates against an hard-coded set of validation rules (Zalando's official guidelines)

It will be interesting to know - after Zally introduces support for user-provided rule sets - how those rules will be formally structured...