elastic / elastic/package-spec

[Discuss] Usage of `yaml` field type / multiline text fields

Open
#280 3 comments 0 reactions 0 assignees View on GitHub
discuss Team:Ecosystem
Dominant language
Go
Stars
20
Forks
93
Avg merge
15h 10m
Merged PRs (30d)
12

Description

One of the valid user configuration variable types is `yaml`:
https://github.com/elastic/package-spec/blob/1cd07c67d8c7f6aeda10c5f90fdae0a5b8f95155/versions/1/data_stream/manifest.spec.yml#L58

I do not recall much discussion during the original implementation of this type, but the intention was for Fleet UI to display a code editor with YAML syntax highlighting when this variable type is encountered:
https://github.com/elastic/kibana/blob/77636e73a918b0946ec3fda0b67745663e3498a5/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx#L64

We assumed that authors would use this field to allow users to input yaml configuration, i.e. key-value pairs (agnostic of nesting levels, or types of values).

In the Crowdstrike integration, there is one field that expects [multiline text input](https://github.com/elastic/integrations/blob/0457b90a43f4b6a11051226b5c402742902e0a17/packages/crowdstrike/data_stream/fdr/manifest.yml#L115). Originally this field was set to `type: text` which causes Fleet to render a simple one-line input field, which is not a great UX for multiline content, and there was an issue with saving the value due to that. A fix (https://github.com/elastic/integrations/pull/2701) was made by changing it to `type: yaml`. While this works, I'm not sure that `yaml` should be used in this manner for values that are not key-value pairs. Might we consider a different spec for non-yaml, multiline text?

This issue is intended to continue the discussion outside of where the original issue was found.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.