Skip to content

feat: Add global YAML output format support#89

Open
Vaishnav88sk wants to merge 4 commits into
coralogix:masterfrom
Vaishnav88sk:feat/yaml-output-format
Open

feat: Add global YAML output format support#89
Vaishnav88sk wants to merge 4 commits into
coralogix:masterfrom
Vaishnav88sk:feat/yaml-output-format

Conversation

@Vaishnav88sk

Copy link
Copy Markdown

Description

Closes #78

This PR introduces global YAML output format support to the CLI. Users can now pass -o yaml or --output yaml to serialize command responses into YAML format, significantly improving the UX for infrastructure engineers and GitOps workflows.

Files Modified:

  • src/config.rs: Added Yaml to the OutputFormat enum.
  • src/render.rs: Implemented render_yaml, format_yaml, render_yaml_auto, and format_yaml_auto. Added unit tests to verify YAML serialization parity with JSON.
  • src/commands/**/*.rs (Dashboards, Dataprime, API Keys, Scopes, Olly, Views, Roles, SLOs, Metrics, etc.): Wired the OutputFormat::Yaml branch into all command execution match arms.

Verification

# Before
cx dashboards get <id> -o yaml # Error: invalid value 'yaml' for '--output'

# After
cx dashboards get <id> -o yaml
# Returns properly formatted YAML representation of the dashboard

@Vaishnav88sk Vaishnav88sk requested a review from a team as a code owner May 7, 2026 19:29
@CLAassistant

CLAassistant commented May 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fd4e81863

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/config.rs
@Vaishnav88sk Vaishnav88sk force-pushed the feat/yaml-output-format branch from ec5b8f7 to 10888c8 Compare May 7, 2026 19:47

@niv-hertz niv-hertz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the Cargo.lock change, and also re-open this PR with signed commits and I'll approve:

https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account

Comment thread Cargo.lock Outdated
@Vaishnav88sk Vaishnav88sk force-pushed the feat/yaml-output-format branch 2 times, most recently from 74eb9af to 865764e Compare May 11, 2026 15:15
@Vaishnav88sk Vaishnav88sk requested a review from niv-hertz May 11, 2026 15:17
Add `yaml` as a supported output format via `-o yaml` / `--output yaml`.

Changes:
- `src/config.rs`: add `Yaml` variant to `OutputFormat` enum and update `as_str()`
- `src/render.rs`: implement `format_yaml`, `render_yaml`, `format_yaml_auto`,
  `render_yaml_auto` helpers; add unit tests for parity with JSON
- All command modules under `src/commands/`: add `OutputFormat::Yaml` match arms
  so every output site is exhaustively handled (actions, alerts, api_keys,
  connectors, contextual_data, custom_enrichments, dashboards, data_archive,
  data_usage, dataprime, e2m, enrichments, extensions, incidents, integrations,
  ip_access, metrics, notification_testing, olly, parsing_rules, presets,
  recording_rules, retentions, roles, routers, saml, scopes, search_fields,
  slos, suppression_rules, tco_policies, team_groups, users, views, webhooks)

Closes coralogix#78
@Vaishnav88sk Vaishnav88sk force-pushed the feat/yaml-output-format branch from 2fb8be9 to 08c54d1 Compare May 18, 2026 17:04
@Vaishnav88sk

Copy link
Copy Markdown
Author

@niv-hertz

@Vaishnav88sk

Copy link
Copy Markdown
Author

@yonbek waiting for approval

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add global YAML output format support

3 participants