How to roll your own Doc Generator

  1. Create a ConsumerContractRenderer that responds to call and accepts a ConsumerContract (this is the name for the domain model of a “pact”). This should return a String. For an example, see the Markdown::ConsumerContractRenderer.

  2. Create an IndexRenderer. This allows you to create an index file for your docs. It should respond to call and accept the String name of the consumer, and a hash of Hash of pact title => file_name, and return a String. For an example, see the Markdown::IndexRenderer.

  3. Create a Generator. This is responsible for the overall file generating and writing process. Copy the Markdown::Generator and configure it with your own ConsumerContractRenderer, IndexRenderer and file details.

If you would like to generate HTML documentation, see how the HTMLPactRenderer in the Pact Broker does it.