Recipe: Codegen with test gating
Generate implementation stubs from OpenAPI specs, then gate merges on passing generated test suites.
Overview
Meridian watches your spec repo. When an OpenAPI document changes, it emits typed client code and a matching test harness. PRs that fail the generated tests are blocked automatically.
Pipeline
- Push an OpenAPI spec to
specs/ - Meridian runs
openapi-generatorwith your template - Generated client lands in
src/generated/ - Test suite is emitted alongside the client
- CI runs tests; failing PRs are blocked
Config
{
"codegen": {
"generator": "typescript-axios",
"template": "templates/client.mustache",
"output": "src/generated",
"testGate": true
}
}Test gating
When testGate is enabled, Meridian generates a contract test suite that validates every endpoint against the spec. The generated tests are committed alongside the client code. Your CI runs them; Meridian's status check fails the PR if any test breaks.