Skip to content

CLI: array-typed flags reject scalar values and mis-serialize query arrays #587

Description

@JoshMock

Opened from failing KB functional tests in test/functional/kb/definitions/. Array-typed CLI flags reject scalar values and mis-serialize query arrays. Passing a single value to an array field fails validation with should be array, and query array params fail with could not parse array value from json input, so the CLI aborts before the request.

Repro:

node dist/cli.js --json stack kb elastic-agents get-fleet-agent-status-data --agents-ids abc --dry-run
# → should be array

For schema fields of type: array, wrap a single scalar flag value in an array before validation and allow the flag to be repeated. Serialize query arrays in the form Kibana expects. Add a test asserting --agents-ids abc yields ["abc"].

Failing test definitions:

  • elastic_agents_get_fleet_agent_status_data.yml (stack + serverless)
  • security_endpoint_management_api_get_endpoint_metadata_list.yml (stack)
  • security_timeline_api_export_timelines.yml (stack)
  • security_timeline_api_import_timelines.yml (stack)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions