Hi, is there an option to view/download the raw JS...
# pactflow
s
Hi, is there an option to view/download the raw JSON of a PACT within the PACT details page?
I figured that I can view the raw JSON when clicking the "API" button. I find that a bit non-intuitive and would appreciate a "View raw json" button on the pact-details page. Pleaseee :-)
🤔 1
m
There's a drop down to get the URL for the pact for E.g. curl . May I ask why you want/need it?
s
When I open that URL in another browser tab i get presented the PACT details page again. Our provider asked for his provider name he is supposed to use and I was not sure where to find it so I looked for the particular JSON property "provider": "xyz"
Its good that a click on "API" deeplinks to the correct API path already, will document it like that in our best practices manual
h
I did this the other day using Matt's suggestion above and then piping it to jq to remove the hal stuff
jq 'del(._links)' > pacts.json
. My particular case was debugging a pact that unexpectedly passed verification so in order to recreate the build the CI ran. I then changed the verify to look for pacts on my file system.
m
When I open that URL in another browser tab i get presented the PACT details page again.
the api uses media types to determine the content to return. If you open in a browser, the accept is
application/html
so it turns the react page.
Our provider asked for his provider name he is supposed to use and I was not sure where to find it so I looked for the particular JSON property “provider”: “xyz”
you don’t need the JSON for that - it’s on the web page
Provider name is this
s
I would still like a button, because a colleague new to PACT is not able to grasp from where he can see the provider state that he is supposed to support only by UI
that is a bit "obfuscated" by the UI presentation today:
message has been deleted
This is more explicit though:
m
cc: @Shuying Lin
thanks for sharing Stefano
If I understand your need, you need to be able to see the provider states that you need to add to your provider tests, and you believe getting access to the raw pact file will help. Perhaps making them more accessible in the UI would be more helpful?
s
Right. However, since this approach seems to be a quick-win rather than a solution that follows your UX strategy (to have a self-explaining UI), what about this: The UI could make it crystal clear what a provider has to do when a new PACT is published. E.g. by extending the UI here:
m
If there are multiple states, they are comma separated. But your point is definitely valid. I have been thinking it would be great to have code snippets in that vacant space for provider teams to copy and paste. But that is hard to do across the pact languages, and versions within each language.
we are also looking at an application home page, which could potentially amalgamate all of these into a single place that would be more convenient than having to look at each integration separately
I’ll have a think with @Shuying Lin about what we can do in the mean time
thanks for raising
s
thanks!
👍 1