Skip to content

[Dashboards as Code] Add snake case object keys util#250962

Merged
Heenawter merged 10 commits intoelastic:mainfrom
Heenawter:add-snake-case-util_2026-01-29
Jan 30, 2026
Merged

[Dashboards as Code] Add snake case object keys util#250962
Heenawter merged 10 commits intoelastic:mainfrom
Heenawter:add-snake-case-util_2026-01-29

Conversation

@Heenawter
Copy link
Copy Markdown
Contributor

@Heenawter Heenawter commented Jan 29, 2026

Summary

This PR adds a util to the presentation-publishing package that converts all camelCased keys in an object to snake_case. As we continue to snake case all of the dashboard state to make the API specifications, this util will make the state transforms much cleaner.

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@Heenawter Heenawter self-assigned this Jan 29, 2026
@Heenawter Heenawter added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. backport:skip This PR does not require backporting Project:Dashboards API v9.4.0 labels Jan 29, 2026
@Heenawter Heenawter marked this pull request as ready for review January 29, 2026 19:04
@Heenawter Heenawter requested a review from a team as a code owner January 29, 2026 19:04
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jan 29, 2026

⏳ Build in-progress, with failures

Failed CI Steps

History

cc @Heenawter

Copy link
Copy Markdown
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

The test cases and function are looking good! Just commenting to ask for a bit more nuance in the types. I'd also prefer not to have a [key:string]: any

* @param camelCased The object with `camelCased` keys
* @returns The object with `snake_cased` keys
*/
export const convertCamelCasedKeysToSnakeCase = (camelCased: {
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.

I think we should have a bit more nuance in the typing of this function. I'd really like to be able to pass in a Type (snake_cased), have it generate the camelCase version and check the input for any keys in camelCase, then pass back the object with the snake_case type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was actually originally doing something like that, but the IDE was actually not being super useful and still just defaulting to string on hover 😆 I can see if I can fix that though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in f2f209b

@Heenawter Heenawter requested a review from ThomThomson January 30, 2026 16:47
Copy link
Copy Markdown
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Very nice! Thanks for making those typing changes. LGTM!

@Heenawter Heenawter merged commit 781723e into elastic:main Jan 30, 2026
16 checks passed
@Heenawter Heenawter deleted the add-snake-case-util_2026-01-29 branch January 30, 2026 17:54
hannahbrooks pushed a commit to hannahbrooks/kibana that referenced this pull request Jan 30, 2026
## Summary

This PR adds a util to the `presentation-publishing` package that
converts all `camelCased` keys in an object to `snake_case`. As we
continue to snake case all of the dashboard state to make the API
specifications, this util will make the state transforms much cleaner.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
mbondyra added a commit to mbondyra/kibana that referenced this pull request Feb 2, 2026
…iew_cps

* commit '32efd9b2fb078ade51073fd2d0068bc74c029d6b': (49 commits)
  [Security Solution] Rules exceptions subfeatures (elastic#245722)
  [BK] Upgrade axios (elastic#251150)
  Fix AI Connector form fields resetting to default value when cleared by user (elastic#251095)
  deduplicate otel dependencies (elastic#250841)
  Adds initial agents.md file (elastic#250833)
  [index management] Faster index list loading (elastic#246276)
  skip failing test suite (elastic#251086)
  skip failing test suite (elastic#251048)
  [Security Solutions] Trial Companion - adjust UX design (elastic#250910)
  [Traces][Discover] Prevent flyout remount when switching document types in Trace Waterfall (elastic#250406)
  [DOCS][Cases][9.4 & Serverless]: Doc new `Maximum amount of cases to open` setting for case action (elastic#250993)
  [Discover][Traces] Explore trace.id from logs in Discover (elastic#249632)
  Remove ! from SOs docs link (elastic#251097)
  [ML] Maps: Add telemetry events for file uploads (elastic#247543)
  [Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (elastic#250971)
  [Dashboards as Code] Add snake case object keys util (elastic#250962)
  [Core] Remove URL Overflow & Deprecate `storeInSessionStorage` setting (elastic#242972)
  [One Workflow] fix: Fix Variable Retrieval in Workflow Execution Engine (elastic#250852)
  Rework Elastic Managed LLMs page (elastic#251069)
  [Lens powered by ES|QL] Update Switch to Query mode modal warning message (elastic#251051)
  ...
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 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort Project:Dashboards API release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants