|
| 1 | +# PRDoc |
| 2 | + |
| 3 | +## Intro |
| 4 | + |
| 5 | +With the merge of [PR #1946](https://github.com/paritytech/polkadot-sdk/pull/1946), a new method for |
| 6 | +documenting changes has been introduced: `prdoc`. The [prdoc repository](https://github.com/paritytech/prdoc) |
| 7 | +contains more documentation and tooling. |
| 8 | + |
| 9 | +The current document describes how to quickly get started authoring `PRDoc` files. |
| 10 | + |
| 11 | +## Requirements |
| 12 | + |
| 13 | +When creating a PR, the author needs to decides with the `R0` label whether the change (PR) should |
| 14 | +appear in the release notes or not. |
| 15 | + |
| 16 | +Labelling a PR with `R0` means that no `PRDoc` is required. |
| 17 | + |
| 18 | +A PR without the `R0` label **does** require a valid `PRDoc` file to be introduced in the PR. |
| 19 | + |
| 20 | +## PRDoc how-to |
| 21 | + |
| 22 | +A `.prdoc` file is a YAML file with a defined structure (ie JSON Schema). |
| 23 | + |
| 24 | +For significant changes, a `.prdoc` file is mandatory and the file must meet the following |
| 25 | +requirements: |
| 26 | +- file named `pr_NNNN.prdoc` where `NNNN` is the PR number. |
| 27 | + For convenience, those file can also contain a short description: `pr_NNNN_foobar.prdoc`. |
| 28 | +- located under the [`prdoc` folder](https://github.com/paritytech/polkadot-sdk/tree/master/prdoc) of the repository |
| 29 | +- compliant with the [JSON schema](https://json-schema.org/) defined in `prdoc/schema_user.json` |
| 30 | + |
| 31 | +Those requirements can be fulfilled manually without any tooling but a text editor. |
| 32 | + |
| 33 | +## Tooling |
| 34 | + |
| 35 | +Users might find the following helpers convenient: |
| 36 | +- Setup VSCode to be aware of the prdoc schema: see [using VSCode](https://github.com/paritytech/prdoc#using-vscode) |
| 37 | +- Using the `prdoc` cli to: |
| 38 | + - generate a `PRDoc` file from a [template defined in the Polkadot SDK |
| 39 | + repo](https://github.com/paritytech/polkadot-sdk/blob/master/prdoc/.template.prdoc) simply providing a PR number |
| 40 | + - check the validity of one or more `PRDoc` files |
| 41 | + |
| 42 | +## `prdoc` cli usage |
| 43 | + |
| 44 | +The `prdoc` cli documentation can be found at https://github.com/paritytech/prdoc#prdoc |
| 45 | + |
| 46 | +tldr: |
| 47 | +- `prdoc generate <NNNN>` |
| 48 | +- `prdoc check -n <NNNN>` |
| 49 | + |
| 50 | +where <NNNN> is the PR number. |
| 51 | + |
| 52 | +## Pick an audience |
| 53 | + |
| 54 | +While describing a PR, the author needs to consider which audience(s) need to be addressed. |
| 55 | +The list of valid audiences is described and documented in the JSON schema as follow: |
| 56 | + |
| 57 | +- `Node Dev`: Those who build around the client side code. Alternative client builders, SMOLDOT, those who consume RPCs. |
| 58 | + These are people who are oblivious to the runtime changes. They only care about the meta-protocol, not the protocol |
| 59 | + itself. |
| 60 | + |
| 61 | +- `Runtime Dev`: All of those who rely on the runtime. A parachain team that is using a pallet. A DApp that is using a |
| 62 | + pallet. These are people who care about the protocol (WASM), not the meta-protocol (client). |
| 63 | + |
| 64 | +- `Node Operator`: Those who don't write any code and only run code. |
| 65 | + |
| 66 | +- `Runtime User`: Anyone using the runtime. This can be a token holder or a dev writing a front end for a chain. |
| 67 | + |
| 68 | +## Tips |
| 69 | + |
| 70 | +The PRDoc schema is defined in each repo and usually is quite restrictive. |
| 71 | +You cannot simply add a new property to a `PRDoc` file unless the Schema allows it. |
0 commit comments