verifyApiContract<TContract>
Checks a contract against sample payloads: the contract has exactly the methods the cases name, each with both schemas, every schema reports the given vendor and Standard Schema version 1, and each schema accepts every valid payload and refuses every invalid one.
Import:
import { verifyApiContract } from '@mnaoumov/typescript-lib/api-contract-verifier';Signature:
function verifyApiContract(contract: TContract, options: VerifyApiContractOptions<TContract>): Promise<string[]>Parameters:
| Parameter | Type | Description |
|---|---|---|
contract |
TContract | The contract. |
options |
VerifyApiContractOptions<TContract> | The sample payloads and the expected vendor. |
Returns: Promise<string[]> — One message per violation, empty when the contract passes.
Links to this page: