Remove SO root property index signature#64434
Conversation
|
Pinging @elastic/kibana-platform (Team:Platform) |
| acl: 'anyone', | ||
| migrationVersion: {}, | ||
| }); | ||
| } as SavedObjectUnsanitizedDoc); |
There was a problem hiding this comment.
our types are stricter than the code... although the code still supports plugins adding their own root property (the acl type can add the acl root property) there's no plugins using this and we should probably remove this functionality.
There was a problem hiding this comment.
Yea, I feel like migrations are more permissive than they should, at least for plugins.
| return ( | ||
| (doc[prop] && doc[prop].latestVersion) || | ||
| ((doc as any)[prop] && (doc as any)[prop].latestVersion) || | ||
| (doc.migrationVersion && (doc as any).migrationVersion[prop]) |
There was a problem hiding this comment.
Wonder if it's worth to introduce an internal type that keeps this [rootProp: string]: any ?
There was a problem hiding this comment.
I considered it, but it felt like we're losing type safety instead of increasing it. Core doesn't usually touch any of the root properties except the ones that core itself defines (updated_at namespaces), this section that performs the migration is the only exception where Core basically touches data owned by a plugin. So it felt like we could rather have any override here with slightly more type safety everywhere else.
| acl: 'anyone', | ||
| migrationVersion: {}, | ||
| }); | ||
| } as SavedObjectUnsanitizedDoc); |
There was a problem hiding this comment.
Yea, I feel like migrations are more permissive than they should, at least for plugins.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Remove SO root property index signature * Update documentation
* master: (78 commits) Remove SO root property index signature (elastic#64434) [ML] Functional tests - stabilize job row details validations (elastic#64503) [Ingest] Add Global settings flyout (elastic#64276) Bump cypress dev-dependency from 4.2.0 to 4.4.1 (elastic#64408) Migrate saved object of type url to kibana platform (elastic#64043) [NP] Migrate ui capabilities (elastic#64185) Bump karma-mocha dev-dependency from 1.3.0 to 2.0.0 (elastic#64407) Migrate kql_telemetry saved object registration to Kibana platform (elastic#64149) Remove SO autocreateindex error and error page (elastic#64037) Fix issue with yarn.lock (elastic#64496) Bump @hapi/boom dependency from 7.4.2 to 7.4.11 (elastic#64433) Bump gonzales-pe dev-dependency from 4.2.4 to 4.3.0 (elastic#64401) Bump karma dev-dependency from 3.1.4 to 5.0.2 (elastic#64403) Bump iedriver dev-dependency from 3.14.1 to 3.14.2 (elastic#64406) Revert "disable flaky suite (elastic#64382) (elastic#64381) (elastic#64480)" Revert "skip flaky suite (elastic#64310)" skip flaky suite (elastic#64310) disable flaky suite (elastic#64382) (elastic#64381) (elastic#64480) [Maps] Include maps styles in embeddables factory so that they're bundled w/ consuming plugins (elastic#64460) update charts library to 18.4.2 (elastic#64438) ...
…bana into pipeline-editor-part-mvp-2 * 'feature/ingest-node-pipelines' of github.com:elastic/kibana: (152 commits) [Ingest pipelines] Simulate pipeline (elastic#64223) Ability to get scoped call cluster from alerting and action executors (elastic#64432) Add editApp and editPath to embeddable (elastic#64297) TSVB validation: Allow numeric values for axes (elastic#63553) [ML] Fixing optional plugin dependency types (elastic#64450) [Logs UI] Alerting (elastic#62806) [Endpoint] Show Policy Status on Host Details using Policy Response API (elastic#64116) [Maps] update LayerWizard previewLayer to take layerDescriptor instead of ISource (elastic#64461) Remove SO root property index signature (elastic#64434) [ML] Functional tests - stabilize job row details validations (elastic#64503) [Ingest] Add Global settings flyout (elastic#64276) Bump cypress dev-dependency from 4.2.0 to 4.4.1 (elastic#64408) Migrate saved object of type url to kibana platform (elastic#64043) [NP] Migrate ui capabilities (elastic#64185) Bump karma-mocha dev-dependency from 1.3.0 to 2.0.0 (elastic#64407) Migrate kql_telemetry saved object registration to Kibana platform (elastic#64149) Remove SO autocreateindex error and error page (elastic#64037) Fix issue with yarn.lock (elastic#64496) Bump @hapi/boom dependency from 7.4.2 to 7.4.11 (elastic#64433) Bump gonzales-pe dev-dependency from 4.2.4 to 4.3.0 (elastic#64401) ... # Conflicts: # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form.tsx # x-pack/plugins/ingest_pipelines/public/shared_imports.ts
Summary
Remove the root property index signature from
SavedObjectsUnsanitizedDocto increase the type safety of migrations which rely on this type.Checklist
Delete any items that are not applicable to this PR.
For maintainers