Hello everyone, On <https://docs.pact.io/faq/conv...
# general
t
Hello everyone, On https://docs.pact.io/faq/convinceme it says that > The advantages Pact provides are: > • [...] > • The ability to see exactly which fields each consumer is interested in, allowing unused fields to be removed, [...]. Is there a way to get a list of the fields pact thinks can be removed? Or do I manually need to compare the contract with what the provider implements?
y
the provider can remove a field, run the provider verification and if there are no failures then they are pretty confident they can remove it
depending on consumer version selectors the provider will pick up all dependent pacts
t
Okay, got that, but there is no tool that runs the contract verification for all consumers and then gives out which provider fields were not needed by any consumer?
y
no, the pact verifier has no idea about all the provider fields can be returned
it can only check what you provided in the contract, it ignores other fields sent in the response you didnt capture in your contract. you might be able to report on those fields but how would pact know about any endpoints or permutations to the endpoints payload
if you are using bi directional contract testing, where you have an openapi definition, you are better armed for that comparison you want to perform as you have the surface area of an api documented, and you want to ascertain the coverage via whats included in the contracts. i haven’t seen any tooling that does that, and gives you a report
t
> you might be able to report on those fields but how would pact know about any endpoints or permutations to the endpoints payload sure, the recording would just be point-in-time recording generated explictily on request and the provider team would still might need to verify the redudant fields. However I don't quite get how this shouldn't be possible, especially as this is one of the major arguments Pact is promoted with.
y
again it is possible but not in the way you expect
the provider can remove a field, run the provider verification and if there are no failures then they are pretty confident they can remove it
t
Yeah but if I run all the consumer contract verifications and collect the actual provider responses (which I get normally makes no sense), I can collect all fields that haven't been used by ANY of the contracts.
y
we’ve had some requests to store actual provider response in the broker, for various reasons ( we don’t currently capture that ) so this would certainly be another use case where having that information could be leveraged. i’ll try and find some related tickets. i agree it would be nice to be able to serve this information up to a provider, so they at least have an idea presented to them by pact, as to which fields aren’t used. i’d like to be able to achieve something different in giving a provider a view of how much of their api surface is in use, against an openapi spec and the contracts which consumers have against the provider maybe worth posting it as an idea/feature req on the roadmap? https://github.com/pact-foundation/roadmap
👍 1
y
Cheers Tim!
❤️ 1