Skip to content

docs: document period type label and displayLabel [DHIS2-20845] - #1785

Open
karolinelien wants to merge 1 commit into
masterfrom
docs/DHIS2-20845-period-type-label
Open

docs: document period type label and displayLabel [DHIS2-20845]#1785
karolinelien wants to merge 1 commit into
masterfrom
docs/DHIS2-20845-period-type-label

Conversation

@karolinelien

Copy link
Copy Markdown
Contributor

Documents the label / displayLabel support on PeriodType added in 2.43, following up on dhis2/dhis2-releases#261.

Adds a Period types subsection to the Web API introduction chapter (src/developer/web-api/overview.md), inside the existing Date and period format section and just after the period-format table, since that is where period types are already described. Covers GET /api/periodTypes with a property table marking label as the only writable field, plus a Custom period type labels subsection with the PUT request, the success response, the verify response, and clearing a label with an empty string.

Three details were checked against dhis2-core rather than taken from the release note, and differ from it:

  • The release note's example body includes all fields (isoDuration, frequencyOrder, and so on). PeriodTypeController.putPeriodType only reads getName() and getLabel(), so everything else is silently ignored. The docs show name + label only.
  • An unknown name returns 400 Bad Request with the message "<name> does not exist."DefaultPeriodService.updatePeriodTypeLabel throws IllegalArgumentException, which CrudControllerAdvice maps to badRequest. The status was not stated anywhere.
  • displayLabel is null, not displayName, when no label is set — PeriodType.getDisplayLabel() returns label directly (with a TODO for the real implementation). The section therefore tells clients to render displayLabel and fall back to displayName, so apps adopting displayLabel now do not show blanks.

Also documents the ALL authority requirement (@RequiresAuthority(anyOf = ALL)).

Targets master only. If the 2.43 docs should carry it as well, that is a cherry-pick onto the 2.43 branch.

AI Assisted

Adds a "Period types" subsection to the Web API introduction chapter,
covering GET /api/periodTypes and the new writable `label` property.

Documents that `label` is the only writable property, that period types
cannot be created or deleted, that the period type is identified by
`name` in the request body, and that a label is cleared with an empty
string. Notes the ALL authority requirement and the 400 response for an
unknown name.

Since `displayLabel` currently mirrors `label` and is null when no label
is set, the section tells clients to render `displayLabel` and fall back
to `displayName`.

AI Assisted

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@karolinelien
karolinelien marked this pull request as ready for review August 27, 2026 11:05

@maikelarabori maikelarabori left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just one minor comment.

Thx!


To remove a custom label, set `label` to an empty string:

```json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also do:

{
  "name": "FinancialFeb",
  "label": null
}

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

Successfully merging this pull request may close these issues.

2 participants