API schema & contract tests

A step of the Cloud application tree on Gradus, in the Testing & resilience area: Tests, errors, SLOs.

Publish an API schema and test that the implementation honours it, so clients can trust the contract.

Usually comes after: Test doubles & fixtures.

Prompt for your AI assistant

Define an OpenAPI schema for this API, validate responses against it in tests and add a contract test that fails when the implementation drifts from the schema.

This is https://gradus.kazet.blog/tree/cloud-application/step/api-contract-tests as plain HTML. In a browser the page also lets you mark the step forged and copy a message for your AI assistant.