Skip to content

Feature Request: Support YAML Array Length Counting #6

Description

@Bribruh123

Feature Request: Support YAML Array Length Counting

Summary

Add YAML array length counting to the Data Size Count extension. The extension should display the number of elements in a selected YAML array, similar to its existing data-size counting capabilities.

Example

Given this YAML:

tenants:
  - name: a
  - name: b
  - name: c

When the user selects the tenants array, Data Size Count should report:

Array Length: 3

The feature should also support inline arrays:

environments: [development, testing, production]

Expected count:

Array Length: 3

Expected Behavior

  • Detect when the selected YAML value is an array.
  • Count only the array’s top-level elements.
  • Return 0 for an empty array.
  • Support arrays containing strings, numbers, objects, or nested arrays.
  • Treat each nested array or object as one top-level element.
  • Show a clear message when the selection is not a valid YAML array.
  • Support both block-style and flow-style YAML arrays.

Use Cases

This feature would help users quickly:

  • Check the number of entries in configuration arrays.
  • Validate large YAML configuration files.
  • Count tenants, endpoints, policies, hosts, or other repeated resources.
  • Verify generated YAML without manually counting entries.

Acceptance Criteria

  • Data Size Count recognizes valid YAML arrays.
  • Block-style YAML arrays are supported.
  • Inline YAML arrays are supported.
  • Empty arrays return a count of 0.
  • Nested values are counted by their top-level array entries.
  • Invalid YAML produces a useful error message.
  • The count is accessible through the existing Data Size Count command or interface.
  • Automated tests cover empty, populated, inline, nested, and invalid YAML arrays.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions