Node Express app validated using OpenAPI spec
Using express-openapi-validator
$ git clone
$ cd musical-enigma
$ nvm use
$ yarn install
$ node app.js
Using express-openapi-validate
$ git clone
$ cd musical-enigma
$ nvm use
$ yarn install
$ node app-2.js
GET
http://localhost:3333/musicGET
http://localhost:3333/music?genre=rockGET
http://localhost:3333/music?genre=rock&artist=me&year=1992GET
http://localhost:3333/music?genre=rock&artist=me&year=notanumberGET
http://localhost:3333/instrument
These two libraries pretty much do the same thing, but with different interfaces. I personally recommend using express-openapi-validate (Solution #2). Though we need to write code to manually add a validator each route defintion (compared to Solution #1), it throw better errors that we can catch in our error middlewares and send back to the client.