Skip to content

[9.4] [Docs][Dashboards API] Add field descriptions to controls schemas (#263282)#265504

Merged
kibanamachine merged 1 commit into
elastic:9.4from
kibanamachine:backport/9.4/pr-263282
Apr 24, 2026
Merged

[9.4] [Docs][Dashboards API] Add field descriptions to controls schemas (#263282)#265504
kibanamachine merged 1 commit into
elastic:9.4from
kibanamachine:backport/9.4/pr-263282

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.4:

Questions ?

Please refer to the Backport tool documentation

…astic#263282)

## Summary

Adds API documentation descriptions to the shared controls schemas
package (`@kbn/controls-schemas`). These schemas are used by both the
Dashboards API and Discover — all descriptions are intentionally
API-agnostic (they refer to "the control" rather than "the dashboard").

### Files changed

| File | Descriptions added |
|---|---|
| `control_schema.ts` | 2 (`use_global_filters`, `ignore_validations`) |
| `controls_group_schema.ts` | 3 (`width` improved, `grow` added, 4
object-level `description`+`title` fields) |
| `options_list_schema.ts` | 20 (all fields in display settings, search
technique, sort, selection, DSL control, and ES|QL variable control
variants) |
| `range_slider_schema.ts` | 2 (`value`/`rangeValueSchema`, `step`) |
| `time_slider_schema.ts` | 3 (`start_percentage_of_time_range`,
`end_percentage_of_time_range`, `is_anchored`) |

**Total: ~30 descriptions added or improved.**

### Style followed

- All descriptions end with a period.
- Backticks used for field names, literals, and values.
- Boolean fields follow the pattern: `When \`true\`, [behaviour].
Defaults to \`X\`.`
- Enum/oneOf fields enumerate valid values with explanations and state
the default.
- Object-level schemas (`discriminatedUnion` variants) received
`description` and `title` in their `meta` block.
- ES|QL variable controls are consistently referred to as "ES|QL
variable controls" to make the connection to the `?variable_name` syntax
explicit.

### On `Defaults to X` in description text

`defaultValue`, `min`, and `max` in the schema all generate `default`,
`minimum`, and `maximum` in the OAS output, which Bump renders
automatically. To avoid redundancy:

- **Numeric min/max are not repeated** in descriptions — they are
already surfaced as OAS constraints.
- **`Defaults to X` is kept for boolean and enum fields.** For booleans,
the default is important context that is easy to miss in the constraints
section; stating it inline with the behaviour description makes the
field immediately scannable. For enum fields, the default is kept as
part of the sentence that also explains valid values, since splitting
them would reduce readability.

### Fields intentionally skipped

- `display_settings` (top-level object wrapper) — no description added;
the individual child fields (`placeholder`, `hide_*`) are described
instead.
- `optionsListSelectionSchema` — inline oneOf helper; description added
at the `selected_options` array level which is the consumer-visible
field.

## Test plan

- [ ] Verify no TypeScript errors: `node scripts/type_check --project
src/platform/packages/shared/controls/controls-schemas/tsconfig.json`
- [ ] Verify no lint errors: `node scripts/eslint
src/platform/packages/shared/controls/controls-schemas/src/`
- [ ] Confirm OAS output reflects new descriptions by regenerating the
OAS bundle

---------

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
(cherry picked from commit f05e5a9)
@kibanamachine kibanamachine merged commit d8a89b1 into elastic:9.4 Apr 24, 2026
21 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

cc @florent-leborgne

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants