-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
[Question] Is it possible to use openapi-backend to validate that the response of an API match an OpenAPI spec? #731
Comments
Sure! Would be great actually to document how to use validateResponse in tests 👍 https://openapistack.co/docs/openapi-backend/response-validation/ |
Wow, thank you for that very quick response! I believe the part I was most struggling with was to understand how I attach my Next.js API endpoints as handlers. Would you already have an example of how to do this? |
Here’s a full stack example of using openapi-backend with nextjs. Doesn’t include tests unfortunately https://github.com/anttiviljami/openapi-stack-nextjs-starter |
Thank you very much, I'll give it a try and see where that leads me! |
I took the time to run a few tests and have hit some issues. I don't know if I'm doing it the right way but so far it seems to generally work so I'm wondering if I'm hitting a bug with the OpenAPI validator used. https://github.com/davidlag0/todo-nextjs/pull/663/files The test is code is in And the issue I've been trying to understand, and I'm no OpenAPI expert, is why the test fails with this error message when I use
I removed the And oddly enough, I don't even have to change the Could you help me out with any pointer? Thank you! |
Hi,
I'm currently using
jest-openapi
to validate if the responses of my API match my OpenAPI spec. It does not seem to be supported anymore and I'm looking to replace the tool I'm using for this use case. Is it a use case thatopenapi-backend
supports? I see thatopenapi-backend
is used to mock an API by using an OpenAPI spec but instead of doing that, I would like to use my API code and validate the responses it provides against my OpenAPI spec.Thank you!
The text was updated successfully, but these errors were encountered: