whitlockjc / sway-connect

Connect compatible Swagger integration middleware using the sway API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Design the mock middleware

whitlockjc opened this issue · comments

The swagger-router middleware in swagger-tools not only did routing but it also is where the mocking support in swagger-tools was written. The original idea behind this decision was this: If there is a route handler, use it, otherwise allow swagger-router to send a mock if mocks are enabled. Maybe we'll end up back there but as of right now, I think mocking should be its own thing.

The whole idea of this middleware is to generate a mock response based on the matched Swagger request. It seems pretty simple but if you have any suggestions, I'm all ears.