Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render message pacts elegantly #127

Open
bethesque opened this issue Aug 11, 2017 · 5 comments
Open

Render message pacts elegantly #127

bethesque opened this issue Aug 11, 2017 · 5 comments

Comments

@bethesque
Copy link
Member

Currently the entire document is rendered as JSON. Format it nicely like the HTTP pacts.

@bangn
Copy link
Contributor

bangn commented Dec 21, 2017

Hi @bethesque

Could you please elaborate on this issue?

Currently the entire document is rendered as JSON

Where can I view this document?

Format it nicely like the HTTP pacts.

I assume that work already done with the HTTP pacts. How can I view such pacts?

Sorry, I am new to pacts so those thing may not be trivial to me :).

Cheers,
Bang

@bethesque
Copy link
Member Author

I've just realised that this issue is not a straightforward one and is not a good first issue after all, because the message pacts use the v3 pact specification, which the Ruby implementation does not know how to parse yet. I have already done a heap of explaining and link finding though, so I'll include them for future reference.


If you request the pact URL with `Accept: text/html...", it will give you this nice HTML view of the pact, rather than the JSON.

screen shot 2017-12-22 at 8 00 05 am

The way it is currently rendered is a bit indirect. It uses some code in the pact-ruby project to create a markdown representation of the pact, and then we turn it into HTML, and wrap it in some extra HTML to render it as a pact broker page.

These are the pact resource that render the HTML content type:
https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/api/resources/pact.rb#L81
https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/api/resources/latest_pact.rb#L29

This is the HTML pact renderer
https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/api/renderers/html_pact_renderer.rb

This is the markdown renderer
https://github.com/pact-foundation/pact-ruby/blob/master/lib/pact/doc/markdown/consumer_contract_renderer.rb

@gaeljw
Copy link

gaeljw commented Jan 6, 2023

This issue is still relevant right?

We get the following message on Pact Broker for message pacts:

Note: this contract could not be parsed to a v1 or v2 Pact, showing raw content instead.

Does it mean v3 Pacts are also partially supported yet for HTTP pacts?

@gaeljw
Copy link

gaeljw commented Jan 10, 2023

I'm not familiar with Ruby but of someone can give some pointers to what/where to modify I'll be happy to help.

@bethesque
Copy link
Member Author

It's only the rendering that is not supported - the content itself is fine.

We've actually carded up the work in the Pactflow team's Jira (PACT-523) to do this, but it hasn't been scheduled yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants