Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saved object export: apply export hooks to referenced / nested objects #100769

Merged

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented May 27, 2021

Summary

Fix #100043

onExport type hooks were only invoked for root level objects during the export process. Objects included by reference were not invoking the export hooks, causing inconsistency on the exports when objects were only included implicitly by reference.

This PR fixes this, by invoking a type's onExport hook for objects included by reference inside the export.

Note: objects added to the export via an export hook are still not re-invoking their type's onExport. This is outside of the scope of this PR

Checklist

@pgayvallet pgayvallet added release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.14.0 labels May 31, 2021
Comment on lines +133 to +134
// sort with the provided sort function then with the default export sorting
const exportedObjects = sortObjects(collectedObjects.sort(sortFunction));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This behavior is unchanged, the double sorting was just performed in two different steps

@pgayvallet pgayvallet marked this pull request as ready for review May 31, 2021 12:34
@pgayvallet pgayvallet requested a review from a team as a code owner May 31, 2021 12:34
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Copy link
Member

@Bamieh Bamieh left a comment

Choose a reason for hiding this comment

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

Code LGTM. i think its worth adding a plugin functional test to ensure this behaves as expected

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@pgayvallet pgayvallet merged commit aa8aa7f into elastic:master Jun 4, 2021
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Jun 4, 2021
elastic#100769)

* execute export transform for nested references

* fix sort

* fix duplicate references

* add FTR test
pgayvallet added a commit that referenced this pull request Jun 4, 2021
…objects (#100769) (#101381)

* Saved object export: apply export hooks to referenced / nested objects (#100769)

* execute export transform for nested references

* fix sort

* fix duplicate references

* add FTR test

* fix test data for 7.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export hooks are not called when exporting referenced saved objects
5 participants