Skip to content

[9.4] [Docs][Visualizations API] Add schema descriptions to all 12 chart types (Viz PR B) (#263571)#265997

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

[9.4] [Docs][Visualizations API] Add schema descriptions to all 12 chart types (Viz PR B) (#263571)#265997
kibanamachine merged 1 commit into
elastic:9.4from
kibanamachine:backport/9.4/pr-263571

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

…pes (Viz PR B) (elastic#263571)

## Summary

Part of the Lens Visualizations API documentation series (Viz PR B).
Adds descriptions to all 12 chart type schemas and all supporting
schemas.

**Series:**
- PR 1/4: Introduction overlay — merged (elastic#262595)
- PR 2/4: Endpoint + field descriptions (elastic#263151)
- PR 3/4: Code samples + response examples (elastic#262874)
- **Viz PR B (this PR):** Schema descriptions for all 12 chart types +
supporting schemas

## Approach

Descriptions only — no schema types, validation constraints, or field
names changed. Rebased onto main to pick up elastic#262927 (styling alignment
restructuring).

## What changed

### Operation schemas
- `metric_ops.ts`: object-level descriptions on
`metricOperationDefinitionSchema`,
`fieldMetricOrFormulaOperationDefinitionSchema`
- `bucket_ops.ts`: descriptions on `bucketOperationDefinitionSchema` and
all bucket operation fields; `When \`true\`,` pattern applied throughout
- `shared.ts`: fixed tautological `collapseBySchema` description; fixed
`ignore_global_filters` and `sampling` descriptions; fixed
`axisTitleSchemaProps`

### Chart schemas — all 12 types
Object-level descriptions on DSL variant, ES|QL variant, and union
schema for every chart type. "DSL data source" consistently replaced
with "data view". Additional field-level descriptions on chart-specific
fields (shape, alignment, icon, palette, etc.).

### Supporting schemas
- `color.ts`: descriptions on all color variant schemas; full palette
name list on all palette fields with correct defaults per context
- `format.ts`: descriptions on all format variant schemas
- `filter.ts`: descriptions on `filterSchema` and
`filterWithLabelSchema`
- `index.ts`: description on `lensApiStateSchema` top-level union
- `xy.ts`: `aggregate_first` description fixed

### Style quality pass
- All descriptions standardised to noun phrases (no verb-first
descriptions)
- `A/An` added to concrete countable noun descriptions
- Dropped valid enum values restored (alignment, slice label position,
donut hole size)
- Redundant numeric min/max removed from description text (auto-rendered
by OAS)
- `may` → `can` throughout

### Reverted
Object-level descriptions added to `@kbn/as-code-data-views-schema`
(`dataViewReferenceSchema`, `dataViewSpecSchema`, `runtimeFieldSchema`,
etc.) were **reverted** — object-level `meta.description` on schema
objects in shared packages does not surface in the OAS output. Will use
overlay fallback.

## Test plan
- [x] Rebased onto main; conflicts from elastic#262927 resolved
- [x] Descriptions verified in combined OAS preview on Bump

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

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: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: florent-leborgne <10208282+florent-leborgne@users.noreply.github.com>
Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
(cherry picked from commit 187a8e0)
Comment on lines 60 to 68
palette: schema.maybe(
schema.string({
meta: { description: 'Palette' },
meta: {
description:
"Color palette name. Accepted values: 'default', 'elastic_line_optimized', 'severity', 'eui_amsterdam', 'kibana_v7_legacy', 'elastic_brand_2023'. Defaults to `default`.",
},
defaultValue: DEFAULT_SECONDARY_COMPARE_TO_PALETTE,
})
),
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.

🟢 Low charts/metric.ts:60

The palette description in compareToSchemaShared claims the default is 'default', but defaultValue: DEFAULT_SECONDARY_COMPARE_TO_PALETTE evaluates to 'compare_to'. The description also omits 'compare_to' from the accepted values list. Update the description to match the actual default and include all valid palette names.

Suggested change
palette: schema.maybe(
schema.string({
meta: { description: 'Palette' },
meta: {
description:
"Color palette name. Accepted values: 'default', 'elastic_line_optimized', 'severity', 'eui_amsterdam', 'kibana_v7_legacy', 'elastic_brand_2023'. Defaults to `default`.",
},
defaultValue: DEFAULT_SECONDARY_COMPARE_TO_PALETTE,
})
),
schema.string({
meta: {
description:
"Color palette name. Accepted values: 'default', 'elastic_line_optimized', 'severity', 'eui_amsterdam', 'kibana_v7_legacy', 'elastic_brand_2023', 'compare_to'. Defaults to `compare_to`.",
},
defaultValue: DEFAULT_SECONDARY_COMPARE_TO_PALETTE,
})
🤖 Copy this AI Prompt to have your agent fix this:
In file src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/metric.ts around lines 60-68:

The `palette` description in `compareToSchemaShared` claims the default is `'default'`, but `defaultValue: DEFAULT_SECONDARY_COMPARE_TO_PALETTE` evaluates to `'compare_to'`. The description also omits `'compare_to'` from the accepted values list. Update the description to match the actual default and include all valid palette names.

Evidence trail:
src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/metric.ts lines 60-66 (description says "Defaults to `default`." and lists accepted values without 'compare_to'); src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/metric/defaults.ts line 27 (`DEFAULT_SECONDARY_COMPARE_TO_PALETTE = 'compare_to' as const`)

@kibanamachine
Copy link
Copy Markdown
Contributor Author

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
agentBuilder 1.1MB 1.1MB +1.3KB
cases 2.3MB 2.3MB +1.3KB
dashboard 1.1MB 1.1MB +1.3KB
dashboardAgent 387.0KB 388.3KB +1.3KB
discover 1.9MB 1.9MB +1.3KB
infra 1.5MB 1.5MB +1.3KB
lens 2.0MB 2.0MB +6.6KB
observability 2.0MB 2.0MB +1.3KB
observabilityAIAssistantApp 656.5KB 657.8KB +1.3KB
unifiedDocViewer 671.3KB 672.6KB +1.3KB
total +18.3KB

cc @florent-leborgne

@kibanamachine kibanamachine merged commit 3520122 into elastic:9.4 Apr 28, 2026
21 checks passed
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.

2 participants