feat: Add DSL method to capture an external reference agaist a V4 Pact interaction#573
feat: Add DSL method to capture an external reference agaist a V4 Pact interaction#573rholshausen wants to merge 5 commits into
Conversation
|
Just a note that the build is broken because the version of the FFI required has had some deprecated functions removed, namely It will need to be migrated to 0.5.x of the FFI before this PR can be applied. |
| // AddInteractionReference records an external reference (e.g. a ticket or pull request) | ||
| // against the interaction. References are stored under comments.references[group][name] | ||
| // in the Pact file. This is a V4-only feature. | ||
| func (m *Message) AddInteractionReference(group, name, value string) *Message { |
There was a problem hiding this comment.
@copilot change this and the mock_server.go function to WithReference for consistency with the other APIs, and update usages
There was a problem hiding this comment.
Done in commit 3a66bff. Renamed AddInteractionReference to WithReference in both internal/native/mock_server.go and internal/native/message_server.go, and updated all callers in consumer/http_v4.go, message/v4/asynchronous_message.go, and message/v4/synchronous_message.go.
…om deprecated FFI functions Agent-Logs-Url: https://github.com/pact-foundation/pact-go/sessions/5279a831-3944-43f9-96ac-533cfda80779 Co-authored-by: mefellows <53900+mefellows@users.noreply.github.com>
…tency Agent-Logs-Url: https://github.com/pact-foundation/pact-go/sessions/5279a831-3944-43f9-96ac-533cfda80779 Co-authored-by: mefellows <53900+mefellows@users.noreply.github.com>
Fixed in commits 3a66bff and b9fdecc. The three deprecated FFI functions have been replaced:
The build now compiles and links successfully against pact_ffi v0.5.4. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…e_mock_server_for_transport doesn't support https transport) Agent-Logs-Url: https://github.com/pact-foundation/pact-go/sessions/ed62bbfe-8577-4130-ad4a-cc24f4588070 Co-authored-by: mefellows <53900+mefellows@users.noreply.github.com>
Add
AddExternalReferenceto V4 interactionsAdds a new
AddExternalReference(group, name, value string)method to all V4 interaction types, allowing external references to be recorded against a Pact interaction.This is the Go equivalent of the
reference()method added to pact-js, and wraps thepactffi_add_interaction_referencefunction introduced in pact_ffi v0.5.4.Usage
The method is available on all three V4 interaction types and can be chained with existing builder methods. It may be called multiple times to record references from different systems.
HTTP interactions
Asynchronous message interactions
Synchronous message interactions
Pact file output
References are stored under
comments.references[group][name]in the generated Pact file:{ "comments": { "references": { "Jira": { "TICKET-123": "https://jira.example.com/browse/TICKET-123" } } } }Changes
internal/native/pact.hinternal/native/mock_server.gointernal/native/message_server.goconsumer/http_v4.gomessage/v4/asynchronous_message.gomessage/v4/synchronous_message.goconsumer/http_v4_test.gomessage/v4/asynchronous_message_test.gomessage/v4/synchronous_message_test.go