Skip to content

[Docs][Visualizations API] Add request and response examples for all 5 endpoints#262874

Merged
florent-leborgne merged 6 commits into
mainfrom
lens-api-docs-examples
Apr 20, 2026
Merged

[Docs][Visualizations API] Add request and response examples for all 5 endpoints#262874
florent-leborgne merged 6 commits into
mainfrom
lens-api-docs-examples

Conversation

@florent-leborgne
Copy link
Copy Markdown
Member

@florent-leborgne florent-leborgne commented Apr 13, 2026

Summary

Adds cURL and Console code samples and inlined response examples to all 5 Visualizations API endpoints.

Code samples (x-codeSamples)

Endpoint Examples
POST /api/visualizations Metric chart (data_view_spec); XY line chart; Pie/donut chart; Data table; Metric chart (data_view_reference)
GET /api/visualizations Search visualizations
GET /api/visualizations/{id} Get a visualization
PUT /api/visualizations/{id} Update a visualization
DELETE /api/visualizations/{id} Delete a visualization

Each example has a cURL and Console variant. The esql data source is not covered — it is not yet supported by the Visualizations API (returns 400); use the Dashboards API for ES|QL visualizations.

Response examples

Endpoint Response code Named examples
POST /api/visualizations 201 createMetricVisualizationResponse, createXYVisualizationResponse, createPieVisualizationResponse, createDataTableVisualizationResponse, createDataViewReferenceResponse
GET /api/visualizations 200 searchVisualizationsResponse (two items: metric + XY)
GET /api/visualizations/{id} 200 getVisualizationResponse (metric)
PUT /api/visualizations/{id} 200 updateVisualizationResponse (metric)

All payloads tested against a live Kibana 9.4.0 instance using the Kibana sample logs dataset.

Preview

https://bump.sh/elastic/hub/elastic-apis/doc/visualizations-api-cleanup-intro-get-started/group/endpoint-visualizations

Test plan

  • Verify code samples appear in the upper-right dropdown for each endpoint
  • Verify response examples appear in the Responses section with correct named tabs
  • Confirm all JSON in code samples is fully expanded (no inline objects)

🤖 Generated with Claude Code

Copy link
Copy Markdown
Contributor

@teresaalvarezsoler teresaalvarezsoler left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks @florent-leborgne

@florent-leborgne florent-leborgne marked this pull request as ready for review April 14, 2026 10:10
@florent-leborgne florent-leborgne requested a review from a team as a code owner April 14, 2026 10:10
@florent-leborgne florent-leborgne added Team:Docs release_note:skip Skip the PR/issue when compiling release notes docs APIDocs backport:version Backport to applied version labels v9.4.0 labels Apr 14, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/experience-docs (Team:Docs)

florent-leborgne and others added 4 commits April 14, 2026 12:24
…r all 5 endpoints

Adds request code samples (cURL + Console) and response examples to every
Visualizations API endpoint, following the same pattern as the Dashboards API:

- POST: metric + XY line chart code samples, trimmed 201 response example
- GET (search): code sample, paginated response example with 2 items
- GET /{id}: code sample, single visualization response example
- PUT /{id}: code sample, updated visualization response example
- DELETE /{id}: code sample only (204 no body)

Response examples are based on live API responses with server-added defaults
(sampling, ignore_global_filters, empty_as_null, axis defaults) trimmed for clarity.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Reorder metric data fields to match actual API response: title → data_source → type
  (was incorrectly title → type → data_source in all 4 metric response examples)
- PUT response: set created_at equal to updated_at to match actual API behavior,
  with a note that created_at reflects update time in PUT responses

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Response examples now match the complete live API output including
sampling, ignore_global_filters, empty_as_null, styling (metric),
and axis/styling/legend (XY). These are part of the public contract
and users need to see them to understand what the API returns.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Code samples (x-codeSamples):
- metric (data_view_spec) — cURL + Console
- XY line chart (data_view_spec) — cURL + Console
- pie/donut chart (data_view_spec) — cURL + Console
- data table (data_view_spec) — cURL + Console
- metric (data_view_reference) — cURL + Console

Response examples (201):
- createMetricVisualizationResponse
- createXYVisualizationResponse
- createPieVisualizationResponse
- createDataTableVisualizationResponse
- createDataViewReferenceResponse

All payloads tested against a live Kibana 9.4.0 instance.
Response examples include full server-populated defaults.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

Copy link
Copy Markdown
Member

@alaudazzi alaudazzi left a comment

Choose a reason for hiding this comment

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

LGTM

@florent-leborgne florent-leborgne merged commit 286db8c into main Apr 20, 2026
16 checks passed
@florent-leborgne florent-leborgne deleted the lens-api-docs-examples branch April 20, 2026 13:30
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.4

https://github.com/elastic/kibana/actions/runs/24669312988

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 20, 2026
…5 endpoints (elastic#262874)

## Summary

Adds cURL and Console code samples and inlined response examples to all
5 Visualizations API endpoints.

### Code samples (`x-codeSamples`)

| Endpoint | Examples |
|---|---|
| `POST /api/visualizations` | Metric chart (`data_view_spec`); XY line
chart; Pie/donut chart; Data table; Metric chart (`data_view_reference`)
|
| `GET /api/visualizations` | Search visualizations |
| `GET /api/visualizations/{id}` | Get a visualization |
| `PUT /api/visualizations/{id}` | Update a visualization |
| `DELETE /api/visualizations/{id}` | Delete a visualization |

Each example has a cURL and Console variant. The `esql` data source is
not covered — it is not yet supported by the Visualizations API (returns
400); use the Dashboards API for ES|QL visualizations.

### Response examples

| Endpoint | Response code | Named examples |
|---|---|---|
| `POST /api/visualizations` | 201 | createMetricVisualizationResponse,
createXYVisualizationResponse, createPieVisualizationResponse,
createDataTableVisualizationResponse, createDataViewReferenceResponse |
| `GET /api/visualizations` | 200 | searchVisualizationsResponse (two
items: metric + XY) |
| `GET /api/visualizations/{id}` | 200 | getVisualizationResponse
(metric) |
| `PUT /api/visualizations/{id}` | 200 | updateVisualizationResponse
(metric) |

All payloads tested against a live Kibana 9.4.0 instance using the
Kibana sample logs dataset.

## Preview

https://bump.sh/elastic/hub/elastic-apis/doc/visualizations-api-cleanup-intro-get-started/group/endpoint-visualizations

## Test plan

- [ ] Verify code samples appear in the upper-right dropdown for each
endpoint
- [ ] Verify response examples appear in the Responses section with
correct named tabs
- [ ] Confirm all JSON in code samples is fully expanded (no inline
objects)

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

---------

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit 286db8c)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
9.4

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

florent-leborgne added a commit that referenced this pull request Apr 20, 2026
## Summary

Part of the Lens Visualizations API documentation series.

**Series:**
- PR 1/4: Introduction and get-started overlay — merged (#262595)
- **PR 2/4 (this PR):** Endpoint descriptions and field descriptions
- PR 3/4: Request code samples and response examples (#262874)
- Viz PR B: Chart type schema descriptions (#263571)

## What changed

### Route files — all 5 endpoints
Added `description` strings and `since: '9.4.0'` to all five routes.

### `schema/search.ts`, `schema/create.ts`, `schema/common.ts`
- `query` search param: description added inline
- `id` path param on delete/get/update: improved description
- `total` response field: description added inline

### `schema/delete.ts`, `schema/get.ts`, `schema/update.ts`
Updated `id` description to reference where the ID comes from.

### Shared package: `@kbn/as-code-shared-schemas`
Added `meta.description` to all 7 fields of `asCodeMetaSchema`
(`created_at`, `created_by`, `managed`, `owner`, `updated_at`,
`updated_by`, `version`).

> **Note:** descriptions added to `@kbn/content-management-utils`
(`savedObjectSchema.id`, `searchOptionsSchemas.*`,
`createOptionsSchemas.overwrite`) were **reverted** per feedback from
ThomThomson — content management schemas are not part of the public
as-code API surface. Descriptions for `fields`, `search_fields`,
`overwrite`, and `id` will be handled via overlay fallback.

## Open items
- Two CodeQL findings on `kbn-content-management-utils/src/schema.ts`
(unbounded arrays) — pre-existing, not introduced by this PR
- davismcphee's architectural question answered:
content-management-utils changes reverted

🤖 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>
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Apr 20, 2026
…ic#263151)

## Summary

Part of the Lens Visualizations API documentation series.

**Series:**
- PR 1/4: Introduction and get-started overlay — merged (elastic#262595)
- **PR 2/4 (this PR):** Endpoint descriptions and field descriptions
- PR 3/4: Request code samples and response examples (elastic#262874)
- Viz PR B: Chart type schema descriptions (elastic#263571)

## What changed

### Route files — all 5 endpoints
Added `description` strings and `since: '9.4.0'` to all five routes.

### `schema/search.ts`, `schema/create.ts`, `schema/common.ts`
- `query` search param: description added inline
- `id` path param on delete/get/update: improved description
- `total` response field: description added inline

### `schema/delete.ts`, `schema/get.ts`, `schema/update.ts`
Updated `id` description to reference where the ID comes from.

### Shared package: `@kbn/as-code-shared-schemas`
Added `meta.description` to all 7 fields of `asCodeMetaSchema`
(`created_at`, `created_by`, `managed`, `owner`, `updated_at`,
`updated_by`, `version`).

> **Note:** descriptions added to `@kbn/content-management-utils`
(`savedObjectSchema.id`, `searchOptionsSchemas.*`,
`createOptionsSchemas.overwrite`) were **reverted** per feedback from
ThomThomson — content management schemas are not part of the public
as-code API surface. Descriptions for `fields`, `search_fields`,
`overwrite`, and `id` will be handled via overlay fallback.

## Open items
- Two CodeQL findings on `kbn-content-management-utils/src/schema.ts`
(unbounded arrays) — pre-existing, not introduced by this PR
- davismcphee's architectural question answered:
content-management-utils changes reverted

🤖 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>
(cherry picked from commit c2bbbc4)
kibanamachine added a commit that referenced this pull request Apr 20, 2026
…r all 5 endpoints (#262874) (#264416)

# Backport

This will backport the following commits from `main` to `9.4`:
- [[Docs][Visualizations API] Add request and response examples for all
5 endpoints (#262874)](#262874)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Florent
LB","email":"florent.leborgne@elastic.co"},"sourceCommit":{"committedDate":"2026-04-20T13:30:10Z","message":"[Docs][Visualizations
API] Add request and response examples for all 5 endpoints
(#262874)\n\n## Summary\n\nAdds cURL and Console code samples and
inlined response examples to all\n5 Visualizations API endpoints.\n\n###
Code samples (`x-codeSamples`)\n\n| Endpoint | Examples |\n|---|---|\n|
`POST /api/visualizations` | Metric chart (`data_view_spec`); XY
line\nchart; Pie/donut chart; Data table; Metric chart
(`data_view_reference`)\n|\n| `GET /api/visualizations` | Search
visualizations |\n| `GET /api/visualizations/{id}` | Get a visualization
|\n| `PUT /api/visualizations/{id}` | Update a visualization |\n|
`DELETE /api/visualizations/{id}` | Delete a visualization |\n\nEach
example has a cURL and Console variant. The `esql` data source is\nnot
covered — it is not yet supported by the Visualizations API
(returns\n400); use the Dashboards API for ES|QL visualizations.\n\n###
Response examples\n\n| Endpoint | Response code | Named examples
|\n|---|---|---|\n| `POST /api/visualizations` | 201 |
createMetricVisualizationResponse,\ncreateXYVisualizationResponse,
createPieVisualizationResponse,\ncreateDataTableVisualizationResponse,
createDataViewReferenceResponse |\n| `GET /api/visualizations` | 200 |
searchVisualizationsResponse (two\nitems: metric + XY) |\n| `GET
/api/visualizations/{id}` | 200 | getVisualizationResponse\n(metric)
|\n| `PUT /api/visualizations/{id}` | 200 |
updateVisualizationResponse\n(metric) |\n\nAll payloads tested against a
live Kibana 9.4.0 instance using the\nKibana sample logs dataset.\n\n##
Preview\n\n\nhttps://bump.sh/elastic/hub/elastic-apis/doc/visualizations-api-cleanup-intro-get-started/group/endpoint-visualizations\n\n##
Test plan\n\n- [ ] Verify code samples appear in the upper-right
dropdown for each\nendpoint\n- [ ] Verify response examples appear in
the Responses section with\ncorrect named tabs\n- [ ] Confirm all JSON
in code samples is fully expanded (no inline\nobjects)\n\n🤖 Generated
with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context)
<noreply@anthropic.com>","sha":"286db8cc5002de3c0d9620d3bd2e0436e7ca8344","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","docs","APIDocs","backport:version","v9.4.0","v9.5.0"],"title":"[Docs][Visualizations
API] Add request and response examples for all 5
endpoints","number":262874,"url":"https://github.com/elastic/kibana/pull/262874","mergeCommit":{"message":"[Docs][Visualizations
API] Add request and response examples for all 5 endpoints
(#262874)\n\n## Summary\n\nAdds cURL and Console code samples and
inlined response examples to all\n5 Visualizations API endpoints.\n\n###
Code samples (`x-codeSamples`)\n\n| Endpoint | Examples |\n|---|---|\n|
`POST /api/visualizations` | Metric chart (`data_view_spec`); XY
line\nchart; Pie/donut chart; Data table; Metric chart
(`data_view_reference`)\n|\n| `GET /api/visualizations` | Search
visualizations |\n| `GET /api/visualizations/{id}` | Get a visualization
|\n| `PUT /api/visualizations/{id}` | Update a visualization |\n|
`DELETE /api/visualizations/{id}` | Delete a visualization |\n\nEach
example has a cURL and Console variant. The `esql` data source is\nnot
covered — it is not yet supported by the Visualizations API
(returns\n400); use the Dashboards API for ES|QL visualizations.\n\n###
Response examples\n\n| Endpoint | Response code | Named examples
|\n|---|---|---|\n| `POST /api/visualizations` | 201 |
createMetricVisualizationResponse,\ncreateXYVisualizationResponse,
createPieVisualizationResponse,\ncreateDataTableVisualizationResponse,
createDataViewReferenceResponse |\n| `GET /api/visualizations` | 200 |
searchVisualizationsResponse (two\nitems: metric + XY) |\n| `GET
/api/visualizations/{id}` | 200 | getVisualizationResponse\n(metric)
|\n| `PUT /api/visualizations/{id}` | 200 |
updateVisualizationResponse\n(metric) |\n\nAll payloads tested against a
live Kibana 9.4.0 instance using the\nKibana sample logs dataset.\n\n##
Preview\n\n\nhttps://bump.sh/elastic/hub/elastic-apis/doc/visualizations-api-cleanup-intro-get-started/group/endpoint-visualizations\n\n##
Test plan\n\n- [ ] Verify code samples appear in the upper-right
dropdown for each\nendpoint\n- [ ] Verify response examples appear in
the Responses section with\ncorrect named tabs\n- [ ] Confirm all JSON
in code samples is fully expanded (no inline\nobjects)\n\n🤖 Generated
with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context)
<noreply@anthropic.com>","sha":"286db8cc5002de3c0d9620d3bd2e0436e7ca8344"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/262874","number":262874,"mergeCommit":{"message":"[Docs][Visualizations
API] Add request and response examples for all 5 endpoints
(#262874)\n\n## Summary\n\nAdds cURL and Console code samples and
inlined response examples to all\n5 Visualizations API endpoints.\n\n###
Code samples (`x-codeSamples`)\n\n| Endpoint | Examples |\n|---|---|\n|
`POST /api/visualizations` | Metric chart (`data_view_spec`); XY
line\nchart; Pie/donut chart; Data table; Metric chart
(`data_view_reference`)\n|\n| `GET /api/visualizations` | Search
visualizations |\n| `GET /api/visualizations/{id}` | Get a visualization
|\n| `PUT /api/visualizations/{id}` | Update a visualization |\n|
`DELETE /api/visualizations/{id}` | Delete a visualization |\n\nEach
example has a cURL and Console variant. The `esql` data source is\nnot
covered — it is not yet supported by the Visualizations API
(returns\n400); use the Dashboards API for ES|QL visualizations.\n\n###
Response examples\n\n| Endpoint | Response code | Named examples
|\n|---|---|---|\n| `POST /api/visualizations` | 201 |
createMetricVisualizationResponse,\ncreateXYVisualizationResponse,
createPieVisualizationResponse,\ncreateDataTableVisualizationResponse,
createDataViewReferenceResponse |\n| `GET /api/visualizations` | 200 |
searchVisualizationsResponse (two\nitems: metric + XY) |\n| `GET
/api/visualizations/{id}` | 200 | getVisualizationResponse\n(metric)
|\n| `PUT /api/visualizations/{id}` | 200 |
updateVisualizationResponse\n(metric) |\n\nAll payloads tested against a
live Kibana 9.4.0 instance using the\nKibana sample logs dataset.\n\n##
Preview\n\n\nhttps://bump.sh/elastic/hub/elastic-apis/doc/visualizations-api-cleanup-intro-get-started/group/endpoint-visualizations\n\n##
Test plan\n\n- [ ] Verify code samples appear in the upper-right
dropdown for each\nendpoint\n- [ ] Verify response examples appear in
the Responses section with\ncorrect named tabs\n- [ ] Confirm all JSON
in code samples is fully expanded (no inline\nobjects)\n\n🤖 Generated
with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context)
<noreply@anthropic.com>","sha":"286db8cc5002de3c0d9620d3bd2e0436e7ca8344"}}]}]
BACKPORT-->

Co-authored-by: Florent LB <florent.leborgne@elastic.co>
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
kibanamachine added a commit that referenced this pull request Apr 20, 2026
…263151) (#264423)

# Backport

This will backport the following commits from `main` to `9.4`:
- [[Docs][Visualizations API] Add endpoint and field descriptions
(#263151)](#263151)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Florent
LB","email":"florent.leborgne@elastic.co"},"sourceCommit":{"committedDate":"2026-04-20T13:39:35Z","message":"[Docs][Visualizations
API] Add endpoint and field descriptions (#263151)\n\n## Summary\n\nPart
of the Lens Visualizations API documentation series.\n\n**Series:**\n-
PR 1/4: Introduction and get-started overlay — merged (#262595)\n- **PR
2/4 (this PR):** Endpoint descriptions and field descriptions\n- PR 3/4:
Request code samples and response examples (#262874)\n- Viz PR B: Chart
type schema descriptions (#263571)\n\n## What changed\n\n### Route files
— all 5 endpoints\nAdded `description` strings and `since: '9.4.0'` to
all five routes.\n\n### `schema/search.ts`, `schema/create.ts`,
`schema/common.ts`\n- `query` search param: description added inline\n-
`id` path param on delete/get/update: improved description\n- `total`
response field: description added inline\n\n### `schema/delete.ts`,
`schema/get.ts`, `schema/update.ts`\nUpdated `id` description to
reference where the ID comes from.\n\n### Shared package:
`@kbn/as-code-shared-schemas`\nAdded `meta.description` to all 7 fields
of `asCodeMetaSchema`\n(`created_at`, `created_by`, `managed`, `owner`,
`updated_at`,\n`updated_by`, `version`).\n\n> **Note:** descriptions
added to `@kbn/content-management-utils`\n(`savedObjectSchema.id`,
`searchOptionsSchemas.*`,\n`createOptionsSchemas.overwrite`) were
**reverted** per feedback from\nThomThomson — content management schemas
are not part of the public\nas-code API surface. Descriptions for
`fields`, `search_fields`,\n`overwrite`, and `id` will be handled via
overlay fallback.\n\n## Open items\n- Two CodeQL findings on
`kbn-content-management-utils/src/schema.ts`\n(unbounded arrays) —
pre-existing, not introduced by this PR\n- davismcphee's architectural
question answered:\ncontent-management-utils changes reverted\n\n🤖
Generated with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"c2bbbc461b994391921301fb2960e7a0b5df929b","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","docs","APIDocs","backport:version","v9.4.0","v9.5.0"],"title":"[Docs][Visualizations
API] Add endpoint and field
descriptions","number":263151,"url":"https://github.com/elastic/kibana/pull/263151","mergeCommit":{"message":"[Docs][Visualizations
API] Add endpoint and field descriptions (#263151)\n\n## Summary\n\nPart
of the Lens Visualizations API documentation series.\n\n**Series:**\n-
PR 1/4: Introduction and get-started overlay — merged (#262595)\n- **PR
2/4 (this PR):** Endpoint descriptions and field descriptions\n- PR 3/4:
Request code samples and response examples (#262874)\n- Viz PR B: Chart
type schema descriptions (#263571)\n\n## What changed\n\n### Route files
— all 5 endpoints\nAdded `description` strings and `since: '9.4.0'` to
all five routes.\n\n### `schema/search.ts`, `schema/create.ts`,
`schema/common.ts`\n- `query` search param: description added inline\n-
`id` path param on delete/get/update: improved description\n- `total`
response field: description added inline\n\n### `schema/delete.ts`,
`schema/get.ts`, `schema/update.ts`\nUpdated `id` description to
reference where the ID comes from.\n\n### Shared package:
`@kbn/as-code-shared-schemas`\nAdded `meta.description` to all 7 fields
of `asCodeMetaSchema`\n(`created_at`, `created_by`, `managed`, `owner`,
`updated_at`,\n`updated_by`, `version`).\n\n> **Note:** descriptions
added to `@kbn/content-management-utils`\n(`savedObjectSchema.id`,
`searchOptionsSchemas.*`,\n`createOptionsSchemas.overwrite`) were
**reverted** per feedback from\nThomThomson — content management schemas
are not part of the public\nas-code API surface. Descriptions for
`fields`, `search_fields`,\n`overwrite`, and `id` will be handled via
overlay fallback.\n\n## Open items\n- Two CodeQL findings on
`kbn-content-management-utils/src/schema.ts`\n(unbounded arrays) —
pre-existing, not introduced by this PR\n- davismcphee's architectural
question answered:\ncontent-management-utils changes reverted\n\n🤖
Generated with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"c2bbbc461b994391921301fb2960e7a0b5df929b"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/263151","number":263151,"mergeCommit":{"message":"[Docs][Visualizations
API] Add endpoint and field descriptions (#263151)\n\n## Summary\n\nPart
of the Lens Visualizations API documentation series.\n\n**Series:**\n-
PR 1/4: Introduction and get-started overlay — merged (#262595)\n- **PR
2/4 (this PR):** Endpoint descriptions and field descriptions\n- PR 3/4:
Request code samples and response examples (#262874)\n- Viz PR B: Chart
type schema descriptions (#263571)\n\n## What changed\n\n### Route files
— all 5 endpoints\nAdded `description` strings and `since: '9.4.0'` to
all five routes.\n\n### `schema/search.ts`, `schema/create.ts`,
`schema/common.ts`\n- `query` search param: description added inline\n-
`id` path param on delete/get/update: improved description\n- `total`
response field: description added inline\n\n### `schema/delete.ts`,
`schema/get.ts`, `schema/update.ts`\nUpdated `id` description to
reference where the ID comes from.\n\n### Shared package:
`@kbn/as-code-shared-schemas`\nAdded `meta.description` to all 7 fields
of `asCodeMetaSchema`\n(`created_at`, `created_by`, `managed`, `owner`,
`updated_at`,\n`updated_by`, `version`).\n\n> **Note:** descriptions
added to `@kbn/content-management-utils`\n(`savedObjectSchema.id`,
`searchOptionsSchemas.*`,\n`createOptionsSchemas.overwrite`) were
**reverted** per feedback from\nThomThomson — content management schemas
are not part of the public\nas-code API surface. Descriptions for
`fields`, `search_fields`,\n`overwrite`, and `id` will be handled via
overlay fallback.\n\n## Open items\n- Two CodeQL findings on
`kbn-content-management-utils/src/schema.ts`\n(unbounded arrays) —
pre-existing, not introduced by this PR\n- davismcphee's architectural
question answered:\ncontent-management-utils changes reverted\n\n🤖
Generated with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"c2bbbc461b994391921301fb2960e7a0b5df929b"}}]}]
BACKPORT-->

Co-authored-by: Florent LB <florent.leborgne@elastic.co>
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
florent-leborgne added a commit that referenced this pull request Apr 28, 2026
…pes (Viz PR B) (#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 (#262595)
- PR 2/4: Endpoint + field descriptions (#263151)
- PR 3/4: Code samples + response examples (#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 #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 #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>
kibanamachine added a commit that referenced this pull request Apr 28, 2026
…art types (Viz PR B) (#263571) (#265997)

# Backport

This will backport the following commits from `main` to `9.4`:
- [[Docs][Visualizations API] Add schema descriptions to all 12 chart
types (Viz PR B)
(#263571)](#263571)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Florent
LB","email":"florent.leborgne@elastic.co"},"sourceCommit":{"committedDate":"2026-04-28T09:59:20Z","message":"[Docs][Visualizations
API] Add schema descriptions to all 12 chart types (Viz PR B)
(#263571)\n\n## Summary\n\nPart of the Lens Visualizations API
documentation series (Viz PR B).\nAdds descriptions to all 12 chart type
schemas and all supporting\nschemas.\n\n**Series:**\n- PR 1/4:
Introduction overlay — merged (#262595)\n- PR 2/4: Endpoint + field
descriptions (#263151)\n- PR 3/4: Code samples + response examples
(#262874)\n- **Viz PR B (this PR):** Schema descriptions for all 12
chart types +\nsupporting schemas\n\n## Approach\n\nDescriptions only —
no schema types, validation constraints, or field\nnames changed.
Rebased onto main to pick up #262927 (styling
alignment\nrestructuring).\n\n## What changed\n\n### Operation
schemas\n- `metric_ops.ts`: object-level descriptions
on\n`metricOperationDefinitionSchema`,\n`fieldMetricOrFormulaOperationDefinitionSchema`\n-
`bucket_ops.ts`: descriptions on `bucketOperationDefinitionSchema`
and\nall bucket operation fields; `When \\`true\\`,` pattern applied
throughout\n- `shared.ts`: fixed tautological `collapseBySchema`
description; fixed\n`ignore_global_filters` and `sampling` descriptions;
fixed\n`axisTitleSchemaProps`\n\n### Chart schemas — all 12
types\nObject-level descriptions on DSL variant, ES|QL variant, and
union\nschema for every chart type. \"DSL data source\" consistently
replaced\nwith \"data view\". Additional field-level descriptions on
chart-specific\nfields (shape, alignment, icon, palette, etc.).\n\n###
Supporting schemas\n- `color.ts`: descriptions on all color variant
schemas; full palette\nname list on all palette fields with correct
defaults per context\n- `format.ts`: descriptions on all format variant
schemas\n- `filter.ts`: descriptions on `filterSchema`
and\n`filterWithLabelSchema`\n- `index.ts`: description on
`lensApiStateSchema` top-level union\n- `xy.ts`: `aggregate_first`
description fixed\n\n### Style quality pass\n- All descriptions
standardised to noun phrases (no verb-first\ndescriptions)\n- `A/An`
added to concrete countable noun descriptions\n- Dropped valid enum
values restored (alignment, slice label position,\ndonut hole size)\n-
Redundant numeric min/max removed from description text
(auto-rendered\nby OAS)\n- `may` → `can` throughout\n\n###
Reverted\nObject-level descriptions added to
`@kbn/as-code-data-views-schema`\n(`dataViewReferenceSchema`,
`dataViewSpecSchema`, `runtimeFieldSchema`,\netc.) were **reverted** —
object-level `meta.description` on schema\nobjects in shared packages
does not surface in the OAS output. Will use\noverlay fallback.\n\n##
Test plan\n- [x] Rebased onto main; conflicts from #262927 resolved\n-
[x] Descriptions verified in combined OAS preview on Bump\n\n🤖 Generated
with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
copilot-swe-agent[bot]
<198982749+Copilot@users.noreply.github.com>\nCo-authored-by:
florent-leborgne
<10208282+florent-leborgne@users.noreply.github.com>\nCo-authored-by:
Marco Vettorello
<vettorello.marco@gmail.com>","sha":"187a8e0c74b9cd78b0b963e3abf92211bc0a7939","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","docs","APIDocs","backport:version","v9.4.0","v9.5.0"],"title":"[Docs][Visualizations
API] Add schema descriptions to all 12 chart types (Viz PR
B)","number":263571,"url":"https://github.com/elastic/kibana/pull/263571","mergeCommit":{"message":"[Docs][Visualizations
API] Add schema descriptions to all 12 chart types (Viz PR B)
(#263571)\n\n## Summary\n\nPart of the Lens Visualizations API
documentation series (Viz PR B).\nAdds descriptions to all 12 chart type
schemas and all supporting\nschemas.\n\n**Series:**\n- PR 1/4:
Introduction overlay — merged (#262595)\n- PR 2/4: Endpoint + field
descriptions (#263151)\n- PR 3/4: Code samples + response examples
(#262874)\n- **Viz PR B (this PR):** Schema descriptions for all 12
chart types +\nsupporting schemas\n\n## Approach\n\nDescriptions only —
no schema types, validation constraints, or field\nnames changed.
Rebased onto main to pick up #262927 (styling
alignment\nrestructuring).\n\n## What changed\n\n### Operation
schemas\n- `metric_ops.ts`: object-level descriptions
on\n`metricOperationDefinitionSchema`,\n`fieldMetricOrFormulaOperationDefinitionSchema`\n-
`bucket_ops.ts`: descriptions on `bucketOperationDefinitionSchema`
and\nall bucket operation fields; `When \\`true\\`,` pattern applied
throughout\n- `shared.ts`: fixed tautological `collapseBySchema`
description; fixed\n`ignore_global_filters` and `sampling` descriptions;
fixed\n`axisTitleSchemaProps`\n\n### Chart schemas — all 12
types\nObject-level descriptions on DSL variant, ES|QL variant, and
union\nschema for every chart type. \"DSL data source\" consistently
replaced\nwith \"data view\". Additional field-level descriptions on
chart-specific\nfields (shape, alignment, icon, palette, etc.).\n\n###
Supporting schemas\n- `color.ts`: descriptions on all color variant
schemas; full palette\nname list on all palette fields with correct
defaults per context\n- `format.ts`: descriptions on all format variant
schemas\n- `filter.ts`: descriptions on `filterSchema`
and\n`filterWithLabelSchema`\n- `index.ts`: description on
`lensApiStateSchema` top-level union\n- `xy.ts`: `aggregate_first`
description fixed\n\n### Style quality pass\n- All descriptions
standardised to noun phrases (no verb-first\ndescriptions)\n- `A/An`
added to concrete countable noun descriptions\n- Dropped valid enum
values restored (alignment, slice label position,\ndonut hole size)\n-
Redundant numeric min/max removed from description text
(auto-rendered\nby OAS)\n- `may` → `can` throughout\n\n###
Reverted\nObject-level descriptions added to
`@kbn/as-code-data-views-schema`\n(`dataViewReferenceSchema`,
`dataViewSpecSchema`, `runtimeFieldSchema`,\netc.) were **reverted** —
object-level `meta.description` on schema\nobjects in shared packages
does not surface in the OAS output. Will use\noverlay fallback.\n\n##
Test plan\n- [x] Rebased onto main; conflicts from #262927 resolved\n-
[x] Descriptions verified in combined OAS preview on Bump\n\n🤖 Generated
with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
copilot-swe-agent[bot]
<198982749+Copilot@users.noreply.github.com>\nCo-authored-by:
florent-leborgne
<10208282+florent-leborgne@users.noreply.github.com>\nCo-authored-by:
Marco Vettorello
<vettorello.marco@gmail.com>","sha":"187a8e0c74b9cd78b0b963e3abf92211bc0a7939"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/263571","number":263571,"mergeCommit":{"message":"[Docs][Visualizations
API] Add schema descriptions to all 12 chart types (Viz PR B)
(#263571)\n\n## Summary\n\nPart of the Lens Visualizations API
documentation series (Viz PR B).\nAdds descriptions to all 12 chart type
schemas and all supporting\nschemas.\n\n**Series:**\n- PR 1/4:
Introduction overlay — merged (#262595)\n- PR 2/4: Endpoint + field
descriptions (#263151)\n- PR 3/4: Code samples + response examples
(#262874)\n- **Viz PR B (this PR):** Schema descriptions for all 12
chart types +\nsupporting schemas\n\n## Approach\n\nDescriptions only —
no schema types, validation constraints, or field\nnames changed.
Rebased onto main to pick up #262927 (styling
alignment\nrestructuring).\n\n## What changed\n\n### Operation
schemas\n- `metric_ops.ts`: object-level descriptions
on\n`metricOperationDefinitionSchema`,\n`fieldMetricOrFormulaOperationDefinitionSchema`\n-
`bucket_ops.ts`: descriptions on `bucketOperationDefinitionSchema`
and\nall bucket operation fields; `When \\`true\\`,` pattern applied
throughout\n- `shared.ts`: fixed tautological `collapseBySchema`
description; fixed\n`ignore_global_filters` and `sampling` descriptions;
fixed\n`axisTitleSchemaProps`\n\n### Chart schemas — all 12
types\nObject-level descriptions on DSL variant, ES|QL variant, and
union\nschema for every chart type. \"DSL data source\" consistently
replaced\nwith \"data view\". Additional field-level descriptions on
chart-specific\nfields (shape, alignment, icon, palette, etc.).\n\n###
Supporting schemas\n- `color.ts`: descriptions on all color variant
schemas; full palette\nname list on all palette fields with correct
defaults per context\n- `format.ts`: descriptions on all format variant
schemas\n- `filter.ts`: descriptions on `filterSchema`
and\n`filterWithLabelSchema`\n- `index.ts`: description on
`lensApiStateSchema` top-level union\n- `xy.ts`: `aggregate_first`
description fixed\n\n### Style quality pass\n- All descriptions
standardised to noun phrases (no verb-first\ndescriptions)\n- `A/An`
added to concrete countable noun descriptions\n- Dropped valid enum
values restored (alignment, slice label position,\ndonut hole size)\n-
Redundant numeric min/max removed from description text
(auto-rendered\nby OAS)\n- `may` → `can` throughout\n\n###
Reverted\nObject-level descriptions added to
`@kbn/as-code-data-views-schema`\n(`dataViewReferenceSchema`,
`dataViewSpecSchema`, `runtimeFieldSchema`,\netc.) were **reverted** —
object-level `meta.description` on schema\nobjects in shared packages
does not surface in the OAS output. Will use\noverlay fallback.\n\n##
Test plan\n- [x] Rebased onto main; conflicts from #262927 resolved\n-
[x] Descriptions verified in combined OAS preview on Bump\n\n🤖 Generated
with [Claude
Code](https://claude.com/claude-code)\n\n---------\n\nCo-authored-by:
Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
copilot-swe-agent[bot]
<198982749+Copilot@users.noreply.github.com>\nCo-authored-by:
florent-leborgne
<10208282+florent-leborgne@users.noreply.github.com>\nCo-authored-by:
Marco Vettorello
<vettorello.marco@gmail.com>","sha":"187a8e0c74b9cd78b0b963e3abf92211bc0a7939"}}]}]
BACKPORT-->

Co-authored-by: Florent LB <florent.leborgne@elastic.co>
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.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>
smith pushed a commit to smith/kibana that referenced this pull request Apr 28, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APIDocs backport:version Backport to applied version labels docs release_note:skip Skip the PR/issue when compiling release notes Team:Docs v9.4.0 v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants