Open nsfrias opened 2 years ago
Working on this.
Hi,
After some investigation I found that the pact_ffi rust library needs to be changed to allow metadata to include matchers, the changes that need to happen in my view are:
pactffi_message_with_metadata
function (in pact_ffi/src/mock_server/handles.rs
)to include the metadata rules in the Pact matchingRules
sectionpactffi_message_reify
function (in pact_ffi/src/mock_server/handles.rs
) to reify the metadata values (right now it only handles the contents)In addition to this a very minor change is required in WithMetadata
function in pact-go/internal/native/message_server.go
to build the matching rule (using stringFromInterface()
).
The rust changes will take me a bit as I am yet not very familiar with it. :(
Software versions
Expected behaviour
WithMetadata
method ofgithub.com/pact-foundation/pact-go/v2/message
should accept Pact DSL as argument (something likemap[string]Matcher
similarly toWithJSONContent
) to allow us to set an expectation for metadata properties that are not static -- for example a timestamp.Actual behaviour
WithMetadata
method ofgithub.com/pact-foundation/pact-go/v2/message
only accepts amap[string]string
thus allowing us to define only static metadata properties.