mpashkovskiy/express-oas-generator

The information from the **last** request is never processed / written to openAPI spec file

kiprasmel opened this issue · 5 comments

While creating an example usage project with Jest, I ran into the same error I've had in my own project - the last request seems to be ignored.

Current work-around - create one more dummy request, so that the last request's information will get processed / written.

We'll need to fix this though.

@kiprasmel @mpashkovskiy Let me know if I'm wrong, but this could be related simply to the fact that we're writing the file at handleResponses (which is executed first). Shouldn't we write also (or only) at handleRequests, which is the last middleware?

@maxiejbe could be, not sure though. It should be somewhat simple to fix - we're definitely just missing a write somewhere.

@maxiejbe I think you are right, or alternatively we can only write when UI/spec is served (requested).

Done @kiprasmel @mpashkovskiy! I've made some important changes. Please review #73

#73 is merged and this one should be fixed now