You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WithMetadata method of github.com/pact-foundation/pact-go/v2/message should accept Pact DSL as argument (something like map[string]Matcher similarly to WithJSONContent) to allow us to set an expectation for metadata properties that are not static -- for example a timestamp.
Actual behaviour
WithMetadata method of github.com/pact-foundation/pact-go/v2/message only accepts a map[string]string thus allowing us to define only static metadata properties.
The text was updated successfully, but these errors were encountered:
nsfrias
changed the title
Allow Pact .WithMetadata function to use pact DSL rather than static values
Allow .WithMetadata function to use pact DSL rather than static values
Jun 16, 2022
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:
change the pactffi_message_with_metadata function (in pact_ffi/src/mock_server/handles.rs)to include the metadata rules in the Pact matchingRules section
change the pactffi_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.The text was updated successfully, but these errors were encountered: