Technically, this is possible. Depending on your language and frameworks used. For example, in Ruby, you can use RSpec to create an API plan .
I am not familiar with any tool that does something similar for Node.js (for example, using Express.js DSL).
, , Matter Compiler. (Ruby gem) JSON (AST) API Blueprint.
, . API Blueprint , API.
( ).