Generate requests-mock from open api spec #1685
-
I know that this tool is used to test against functional endpoints. Is it possible to generate requests-mock from open an open API spec? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hi! Could you please, elaborate a bit? What is your use case? |
Beta Was this translation helpful? Give feedback.
-
We have a service which has multiple rest endpoints. They also publish spec. We have a handwritten python rest client for those APIs. We would like to mock rest endpoints (requests-mock) in our test cases according to the spec to validate whether the client is breaking any specification. |
Beta Was this translation helpful? Give feedback.
-
Understood. I had this idea for some time and even wanted to implement it as a separate project / submodule for Schemathesis. But I think you could use |
Beta Was this translation helpful? Give feedback.
-
Thank you for pointing to hypothesis-jsonschema. I had a cursory look and it needs more work to make it work for my use case compared to this project. If someone has to think about an extension for this project where should they start reading the code? |
Beta Was this translation helpful? Give feedback.
Understood. I had this idea for some time and even wanted to implement it as a separate project / submodule for Schemathesis. But I think you could use
hypothesis-jsonschema
instead and generate values based on your schema, however, it does not do any mutations as Schemathesis does to generate negative test cases. You could hook into its internal APIs, but I won't give any guarantees that it won't change