[Dashboards as Code] Add snake case object keys util#250962
[Dashboards as Code] Add snake case object keys util#250962Heenawter merged 10 commits intoelastic:mainfrom
Conversation
src/platform/packages/shared/presentation/presentation_publishing/saved_object_ref.ts
Show resolved
Hide resolved
...platform/packages/shared/presentation/presentation_publishing/state_manager/state_manager.ts
Show resolved
Hide resolved
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
⏳ Build in-progress, with failures
Failed CI StepsHistory
cc @Heenawter |
ThomThomson
left a comment
There was a problem hiding this comment.
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
...platform/packages/shared/presentation/presentation_publishing/state_manager/state_manager.ts
Show resolved
Hide resolved
src/platform/packages/shared/presentation/presentation_publishing/utils/snake_case.test.ts
Show resolved
Hide resolved
| * @param camelCased The object with `camelCased` keys | ||
| * @returns The object with `snake_cased` keys | ||
| */ | ||
| export const convertCamelCasedKeysToSnakeCase = (camelCased: { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
…/kibana into add-snake-case-util_2026-01-29
ThomThomson
left a comment
There was a problem hiding this comment.
Very nice! Thanks for making those typing changes. LGTM!
## 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>
…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) ...
Summary
This PR adds a util to the
presentation-publishingpackage that converts allcamelCasedkeys in an object tosnake_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
release_note:*label is applied per the guidelinesbackport:*labels.