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

Issues with some example package values #42

Closed
jfsiii opened this issue Jul 3, 2019 · 4 comments
Closed

Issues with some example package values #42

jfsiii opened this issue Jul 3, 2019 · 4 comments
Assignees

Comments

@jfsiii
Copy link

jfsiii commented Jul 3, 2019

JSON vs JS objects

Any searchSourceJSON , optionsJSON, panelsJSON, uiStateJSON, and visState fields in dev/package-template should be JSON strings, not JS objects.

I attempted to bulkCreate them and got a JSON.parse error about [object Object]. The error started in a kibana migration handler and I worked backwards the issues in these keys.

I don’t know if there are docs/schemas about this but the sample_data/data_sets have examples

Invalid JSON

The example ingest pipeline has invalid JSON at line 14
Screen Shot 2019-07-11 at 12 47 50 PM

@ruflin
Copy link
Collaborator

ruflin commented Jul 8, 2019

This is actually a mistake made on my end I think. In Beats (from where I copied the data) we decode the JSON object for easier versioning (nice diffs). So the objects above have to be JSON encoded to work.

There are script in the Beats project that do this automatically but we need to change this data to be compatible and decide later on how we better version it (especially as this are only examples).

@jfsiii
Copy link
Author

jfsiii commented Aug 14, 2019

The Integrations Manager converts them to JSON in https://github.com/elastic/kibana/blob/feature-integrations-manager/x-pack/legacy/plugins/integrations_manager/server/integrations/get_objects.ts#L54 if you want to see all the keys to update

@ruflin
Copy link
Collaborator

ruflin commented Nov 11, 2019

@exekias We should discuss the format we want to have it in the package in the end for the Saved object json parts. If we let it encoded, it will be easier for contributors to just copy / paste their asset from Kibana. The downsides are that during development, diffs are impossible to read and is the reason we have it decoded in the modules repo so far.

@ruflin ruflin removed their assignment Nov 18, 2019
ruflin added a commit to ruflin/package-registry that referenced this issue Nov 20, 2019
In the packages, the saved objects are stored with decoded JSON fields. The reason is that this makes versioning of it much easier and the diffs are simpler. But inside Kibana some of the fields are stored as encoded json strings (this might change in the future elastic/kibana#43673). To not require special logic on the Package Manager to encode the strings, this is done directly during packaging.

One thing not too nice about this PR is that it includes now a dependency on `common.MapStr` from Beats. Reason is that it makes the code much simpler.

Part of elastic#42
ruflin added a commit that referenced this issue Nov 26, 2019
In the packages, the saved objects are stored with decoded JSON fields. The reason is that this makes versioning of it much easier and the diffs are simpler. But inside Kibana some of the fields are stored as encoded json strings (this might change in the future elastic/kibana#43673). To not require special logic on the Package Manager to encode the strings, this is done directly during packaging.

One thing not too nice about this PR is that it includes now a dependency on `common.MapStr` from Beats. Reason is that it makes the code much simpler.

Part of #42
@ruflin
Copy link
Collaborator

ruflin commented Nov 26, 2019

Closing as #157 was merged.

@ruflin ruflin closed this as completed Nov 26, 2019
ruflin added a commit to ruflin/kibana that referenced this issue Nov 26, 2019
With elastic/package-registry#157 issue elastic/package-registry#42 has been resolved. This means the code to encode some of the Kibana fields is not needed anymore.
@ruflin ruflin self-assigned this Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants