How to roll your own Doc Generator¶ ↑
-
Create a ConsumerContractRenderer that responds to
call
and accepts aConsumerContract
(this is the name for the domain model of a “pact”). This should return a String. For an example, see the Markdown::ConsumerContractRenderer. -
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 ofpact title => file_name
, and return a String. For an example, see the Markdown::IndexRenderer. -
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.