v2.0.0
Major Changes
-
d359c1a: Add AsyncAPI 3.x support for async and synchronous message contract testing
Breaking Changes
Comparatorconstructor — previously accepted a single positional OAS document argument (new Comparator(oas)); now accepts an options object (new Comparator({ oas?, asyncapi? })). At least one ofoasorasyncapimust be provided.- CLI — the OAS file path was previously a required positional argument (
opc <oas> <pact...>); it is now a named option (opc --oas <path> <pact...>). Use--asyncapi <path>instead of or alongside--oasto pass an AsyncAPI document.
New Features
Asynchronous/Messages— validates async Pact v4 interactions against the corresponding AsyncAPI 3.x operation, checking payload and headers against all messages defined on that operation.Synchronous/Messages— validates synchronous (request + response) Pact v4 interactions. The request is validated against the operation's messages; the response is validated against the messages defined inoperation.reply.- Both interaction types use
operationIdonly for matching — a message is considered matched if the interaction payload and headers are compatible with any message defined on the operation; nomessageIdis needed in the pact file. - Full
$refresolution for message payload and header schemas, includingcomponents/schemasandcomponents/messages.
New Result Codes
Code Type Description message.matchedinfo The interaction matched a message in the spec message.no.matcherror No message in the operation matched the interaction, with per-candidate causes message.reply.missingerror The referenced operation has no replyfield (sync interactions only)message.response.missingwarning A sync interaction defines no responses to validate
Minor Changes
- 2e05886: Internally mutate schema to make working with oneOf/discriminator more consistent with OpenAPI