Val Kolovos
10/02/2024, 2:02 PMpact-python
, but it passes its arguments along to lib.pactffi_with_pact_metadata(
. My example is this:
pact.with_metadata('namespace', {'var_1': 'value_1', 'var_2': 'value_2'})
which breaks down into multiple calls as listed above, but the resulting pact file only contains:
"metadata": {
"namespace": {
"var_2": "value_2"
},
...
Yousaf Nabi (pactflow.io)
pactffi_message_with_metadata_v2
PactFfi::MessageConsumer.with_metadata_v2(message, "namespace",'{"var_1":"value_1","var_2":"value_2"}')
"metadata": {
"contentType": "application/json",
"namespace": {
"var_1": "value_1",
"var_2": "value_2"
}
},
Yousaf Nabi (pactflow.io)
Val Kolovos
10/02/2024, 2:27 PMYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Val Kolovos
10/02/2024, 2:30 PMpact-js
or pact-python
use the v2
function. Guess I'll see about getting that added to those 🙂. Thanks for the info!Val Kolovos
10/02/2024, 2:36 PMpact_metadata
, not message_metadata
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Val Kolovos
10/02/2024, 2:42 PMVal Kolovos
10/02/2024, 2:44 PMYousaf Nabi (pactflow.io)
pact.with_metadata('namespace', {'var_1': 'value_1', 'var_2': 'value_2'})
/**
* Sets the additional metadata on the Pact file. Common uses are to add the client library details such as the name and version
* Returns false if the interaction or Pact can't be modified (i.e. the mock server for it has already started)
*
* * `pact` - Handle to a Pact model
* * `namespace` - the top level metadat key to set any key values on
* * `name` - the key to set
* * `value` - the value to set
*/
bool pactffi_with_pact_metadata(PactHandle pact,
const char *namespace_,
const char *name,
const char *value);
Val Kolovos
10/02/2024, 2:45 PMpactffi_with_pact_metadata
Val Kolovos
10/02/2024, 2:46 PMpactffi_with_pact_metadata('namespace', 'var_1', 'value_1')
pactffi_with_pact_metadata('namespace', 'var_2', 'value_2')
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Val Kolovos
10/02/2024, 3:00 PM