Users can write their own templates for the architecture decision records and specify that they should be used for ADRs using the init
and config
commands.
Templates use their own markup for specifying the substitutions the adr-j
tool uses.
{{field}}
is substituted with the value of field
, e.g.
* Status: {{status}}
After substitution this could look like:
* Status: APPROVED
Lists are specified using {{{listname.listfield}}}
. This is substituted with each value of the field and also copies any markup and content on the same line, e.g.:
* Supersedes [ADR {{{superseded.id}}}]({{{superseded.file}}})
could be replaced with:
* Supersedes [ADR 4](0004-use-asynchronous-communication.md)
* Supersedes [ADR 10](0010-use-a-relational-database.md)
* Supersedes [ADR 13](0013-use-jms-based-queueing-system.md)
Every list has a list field id
. This has to be present. All list fields need to be on the same line, e.g. the following is not valid:
Link: {{link.comment}} See:
{{{link.file}}}
The reasons the above is not valid are:
- No link.id field
- Fields are on separate lines.
Type: field
Description: The identifier of the ADR
Type: field
Description: The name of the ADR
Type: field
Description: The data the ADR was created
Type: field
Description: The initial author of the ADR; it is determined in the following order:
- the value of the environment variable
ADR_AUTHOR
- the value of the JVM system property "user.name"
Type: list
Description: Identifier of the ADR superseded by this ADR
Type: list
Description: File name of the ADR superseded by this ADR
Type: list Description: Identifier of the linked ADR
TYpe: list
Description: File name of the linked ADR
Type: list
Description: Comment about the linked ADR
Type: field
Description: Certain commands (such as link) insert additional, but hidden, information into the ADRs as comments. These are required for when ADR-J modifies or reads the ADR after it has been created. To do this, they need to know how text is commented out in the template's markup language. This (valueless) field is used to do this, by surrounding it with the text used for commenting.
For instance, a markdown template would use HTML comments:
<! –– {{template.comment}} ––>
An ASCIIDOC template would use:
// {{template.comment}}