Bogdan Barliga
09/06/2024, 11:23 AMProviderState
generator in C++.
Will add details in thread.Bogdan Barliga
09/06/2024, 11:25 AMpact_ffi
advertises that it will accept "pact:generator:type": "ProviderState"
.
• Pact specification mentions that the ProviderState
generator is expressed like {type": "ProviderState", "expression": "/api/user/${id}"}
Is it then safe to assume that a potentially new FromProviderState
matcher, used in the context
...
.withResponseJsonBody( Object( {
{ "assetId", FromProviderState( "${id}, "someAssetId" ) },
...
should generate
{ "value": "someAssetId, "pact:generator:type": "ProviderState", "expression": "${id}" }
?
Should there be a type
matcher inserted as well? I can see for example that in pact-js
, the fromProviderState
method "Sets a type matcher and a provider state generator."
I.e.:
{ "value": "someAssetId, "pact:matcher:type":"type", "pact:generator:type": "ProviderState", "expression": "${id}" }
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
ProviderState
generator is not a matcher, so if you need it to also constrain the types, you need to combine matching rules:
https://docs.pact.io/implementation_guides/rust/pact_ffi/integrationjson#supporting-multiple-matching-rules