An easy way to create simple mock from an OpenAPI (fka Swagger) spec without code is to use a tool call prism available at http://github.com/stoplightio/prism written in Typescript.
This command line is all you need:
./prism run --mock --list --spec <your swagger spec file>
The mock server will return a dynamic response based on the OpenAPI spec.
If examples are provided in the spec, prism will return them, if not it will generate dummy data based on the spec.
Edit (Aug 2020):
The command has changed in the latest version. The following will do:
prism mock <your spec file>
It accepts swagger and postman doc as well.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…