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

Support for pretty format in Saved Object import and export #103021

Closed
tylersmalley opened this issue Jun 22, 2021 · 5 comments
Closed

Support for pretty format in Saved Object import and export #103021

tylersmalley opened this issue Jun 22, 2021 · 5 comments
Labels
enhancement New value added to drive a business result Feature:Saved Objects impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc triage_needed

Comments

@tylersmalley
Copy link
Contributor

tylersmalley commented Jun 22, 2021

Within the kbnClient used for functional tests, we have a helper to facilitate importing and exporting saved objects. Currently, we are using a custom format to make it easier to diff these objects and the raw ndjson format makes that difficult. It would be most ideal if the saved objects export/import supported a ?pretty flag or similar. That way developers wouldn't need to use the scripts/kbn_archiver CLI to export objects.

Example object: https://github.com/elastic/kibana/blob/master/test/functional/fixtures/kbn_archiver/visualize.json

@tylersmalley tylersmalley added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Jun 22, 2021
@elasticmachine
Copy link
Contributor

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

@pgayvallet
Copy link
Contributor

pgayvallet commented Jun 23, 2021

Currently, we are using a custom format to make it easier to diff these objects and the raw ndjson format makes that difficult

Given the spec of the ndjson format

1. Line Separator is '\n'
This means '\r\n' is also supported because trailing white space is ignored when parsing JSON values.

2. Each Line is a Valid JSON Value
The most common values will be objects or arrays, but any JSON value is permitted. See json.org for more information about JSON values.

and the fact that a pretty format relies on new lines to indent the json content, I'm not sure the file you linked (https://github.com/elastic/kibana/blob/master/test/functional/fixtures/kbn_archiver/visualize.json) is actually a valid ndjson file?

Can we really prettify the content of a ndjson file without violating the spec?

@tylersmalley
Copy link
Contributor Author

@pgayvallet, is there a reason that the flag would need to produce an ndjson valid spec? The endgoal is to produce a multi-line readable format.

@pgayvallet
Copy link
Contributor

pgayvallet commented Jun 23, 2021

is there a reason that the flag would need to produce an ndjson valid spec?

I get that this would be only for testing purposes. However, the fact that this flag would (AFAIK will have to, as FTR runs in prod mode) be enabled in production, while producing an invalid, non-reimportable file when used, from a public API, bothers me a bit, yea.

Also,

It would be most ideal if the saved objects export/import supported a ?pretty flag or similar

Is the need only for export, or would you expect to also be able to import the file using the same flag during the import?

@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Nov 4, 2021
@pgayvallet
Copy link
Contributor

Not needed anymore - closing

@pgayvallet pgayvallet closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Saved Objects impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc triage_needed
Projects
None yet
Development

No branches or pull requests

4 participants