testinggospels / camouflage

Camouflage is a backend mocking tool for HTTP, gRPC, Websockets and Thrift protocols, which helps you carry out your front end prototyping, unit testing, functional/performance testing in silos, in absence of one or more Microservices/APIs.
https://testinggospels.github.io/camouflage/
MIT License
278 stars 26 forks source link

Schema validation #195

Closed richardruiter closed 2 years ago

richardruiter commented 2 years ago

Discussed in https://github.com/testinggospels/camouflage/discussions/194

Originally posted by **richardruiter** October 23, 2022 Hi, we are implementing Contract Testing and have a need for validating the mocks we create against OpenApi and XML-RPC schemas from the backend teams. This makes sure we don't make false assumptions when using a mock server. We already have a homegrown mockserver with this principle baked in, but we need more functionality and camouflage covers it. First I was thinking to create middleware that can be shared with multiple teams and created a successful PoC with `middleware.js` However then the idea arose to make schema validation part of camouflage server. ``` loglevel: info protocols: http: enable: true mocks_dir: "./mocks" port: 8080 validation: schemas: - https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json - https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/example2.json ``` In the case of OpenApi It would parse the schemas with `@apidevtools/swagger-parser`, validate the request with `openapi-request-validator` and response with `openapi-response-validator.
github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 0.10.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

richardruiter commented 2 years ago

Will you also update the documentation? @shubhendumadhukar

shubhendumadhukar commented 2 years ago

Oh my bad. I forgot that wasn't automated :) On it.

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 0.13.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: