Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting out the request/response validation from the actual request #58

Open
JohnRoux opened this issue Sep 17, 2020 · 0 comments
Open
Assignees

Comments

@JohnRoux
Copy link

JohnRoux commented Sep 17, 2020

I'm currently using a little Laravel package I made to make this more "trait" friendly as well as interact directly with Laravel's internal call methods etc. (I hope I haven't bastardised the implementation too much 😅)

I ended up doing quite a couple overrides which I think might be useful to actually include back here if you're keen for them.

Most notably: I made my own Requester which splits up the send function into: send, validateRequest and validateResponse

I found that doing failed tests was basically impossible with the current implementation.
Eg:
I want to log in without parsing through an email and get a response of type 422 which exists in the OpenApi/Swagger spec.

It would always fail on the request validation and without splitting them up there was no way I could see to easily test it.

Having a validateRequestFails method (which runs the validate with a try-catch) was suuuuuper useful

Anywhoo, this is more of a "do you want it to move in this direction?" Issue and not a bug report etc :)

@byjg byjg self-assigned this Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants