Skip to content

[Lens as Code] Use as code dataView schema#260914

Merged
markov00 merged 24 commits into
elastic:mainfrom
markov00:2026_04_02-use_data_view_schema
Apr 7, 2026
Merged

[Lens as Code] Use as code dataView schema#260914
markov00 merged 24 commits into
elastic:mainfrom
markov00:2026_04_02-use_data_view_schema

Conversation

@markov00
Copy link
Copy Markdown
Contributor

@markov00 markov00 commented Apr 2, 2026

Summary

Fix #260031
Uses the As Code DataView schema from @kbn/as-code-data-views-schema.

I've also aligned the dataset schema property to data_source as also used in discover sessions.

Better to review the first commit, then the second one as I wasn't able to make git happy with the rename and editing of the dataset.ts and dataset.test.ts file. The second commit
just contains the file rename and associated changes

I have touched the code in the @kbn/data-views-schema package to detach its dependency to the @kbn/data-views-plugin for one specific reason:
the unified_doc_viewer was already an indirect consumer of Lens config-builder code, and this PR made that path start pulling in @kbn/data-views-plugin/common at runtime through the new shared data-view schema.
This turned an existing package usage into an undeclared browser-bundle dependency.
So instead of adding the data views plugin as required plugin in the unified_doc_viewer I've thought it was better to split the logic in the as-code package. To avoid creating yet another package for the constants, to keep the changes to a minimal set, I've exported just the types of the constants and recreated the constants in the as-code-data-view package.

@markov00 markov00 changed the title Use as code dataView schema and rename dataset to data_source [Lens as Code] Use as code dataView schema and rename dataset to data_source Apr 2, 2026
@markov00 markov00 added Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// release_note:skip Skip the PR/issue when compiling release notes Feature:Lens backport:skip This PR does not require backporting labels Apr 2, 2026
@elastic elastic deleted a comment from elasticmachine Apr 2, 2026
@markov00 markov00 marked this pull request as ready for review April 3, 2026 07:35
@markov00 markov00 requested review from a team as code owners April 3, 2026 07:35
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@elastic elastic deleted a comment from elasticmachine Apr 3, 2026
Copy link
Copy Markdown
Contributor

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

LGTM, added a couple very minor comments below.

@lukasolson
Copy link
Copy Markdown
Contributor

You will probably want to wait for #261181 to merge before this one, else the OAS generation will break.

Copy link
Copy Markdown
Contributor

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

Code changes LGTM 🎉

@markov00 markov00 enabled auto-merge (squash) April 7, 2026 20:17
@markov00 markov00 changed the title [Lens as Code] Use as code dataView schema and rename dataset to data_source [Lens as Code] Use as code dataView schema Apr 7, 2026
@elastic elastic deleted a comment from elasticmachine Apr 7, 2026
@markov00 markov00 merged commit 575894d into elastic:main Apr 7, 2026
18 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
agentBuilder 1437 1441 +4
cases 2067 2071 +4
dashboard 1114 1118 +4
dashboardAgent 600 604 +4
infra 1838 1842 +4
lens 1729 1733 +4
observability 1892 1896 +4
observabilityAIAssistantApp 819 823 +4
unifiedDocViewer 948 952 +4
total +36

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
dataViews 451 453 +2

Async chunks

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

id before after diff
agentBuilder 801.5KB 801.7KB +234.0B
cases 2.0MB 2.0MB +326.0B
dashboard 865.8KB 866.0KB +237.0B
dashboardAgent 137.1KB 137.3KB +234.0B
discover 1.6MB 1.6MB +272.0B
infra 1.3MB 1.3MB +234.0B
lens 2.0MB 2.0MB +2.2KB
observability 2.2MB 2.2MB +312.0B
observabilityAIAssistantApp 331.0KB 331.2KB +234.0B
unifiedDocViewer 423.9KB 424.1KB +234.0B
total +4.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dashboard 19.2KB 19.2KB -15.0B
lens 83.4KB 83.4KB +12.0B
total -3.0B
Unknown metric groups

API count

id before after diff
dataViews 1261 1263 +2

History

florent-leborgne added a commit that referenced this pull request Apr 8, 2026
Align all YAML examples and overlay inline code with the schema rename
from `dataset` to `data_source` (index→data_view_spec, dataView→data_view_reference,
index→index_pattern, id→ref_id) that landed in main via #260914.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
florent-leborgne added a commit that referenced this pull request Apr 8, 2026
- Fix POST target path from /api/dashboards/{id} to /api/dashboards
- Align all YAML examples and overlay inline code with the schema rename
  from `dataset` to `data_source` (index→data_view_spec, dataView→data_view_reference,
  index→index_pattern, id→ref_id) that landed in main via #260914.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
florent-leborgne added a commit that referenced this pull request Apr 9, 2026
Align all YAML examples and overlay inline code with the schema rename
from `dataset` to `data_source` (index→data_view_spec, dataView→data_view_reference,
index→index_pattern, id→ref_id) that landed in main via #260914.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
florent-leborgne added a commit that referenced this pull request Apr 9, 2026
- Fix POST target path from /api/dashboards/{id} to /api/dashboards
- Align all YAML examples and overlay inline code with the schema rename
  from `dataset` to `data_source` (index→data_view_spec, dataView→data_view_reference,
  index→index_pattern, id→ref_id) that landed in main via #260914.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens as code] Use dataviews schemas

5 participants