Skip to content

fix parsing yaml with dash in keys#21

Merged
jproffitt merged 2 commits intomasterfrom
fix-dash-keys
Jul 28, 2025
Merged

fix parsing yaml with dash in keys#21
jproffitt merged 2 commits intomasterfrom
fix-dash-keys

Conversation

@jproffitt
Copy link
Contributor

@jproffitt jproffitt commented Jul 28, 2025

This fixes cogs yaml parsing when a yaml variable name has a dash/hyphen.

@jproffitt jproffitt requested a review from Copilot July 28, 2025 15:30

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jproffitt jproffitt requested a review from Copilot July 28, 2025 16:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes YAML parsing to properly handle keys that contain dashes by implementing a key mapping strategy that temporarily sanitizes dash-containing keys during parsing and then restores the original keys in the output.

  • Adds logic to detect and map keys with dashes to sanitized versions during dotenv parsing
  • Implements a unique key generation mechanism to avoid collisions when multiple keys have similar patterns
  • Restores original dash-containing keys in the final cache output

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test_files/kustomization.yaml Adds test cases with dash-containing keys to validate the fix
input.go Implements key mapping logic to handle dashes in variable names during YAML parsing
examples/4.read_types.cog.toml Adds example configuration using a dash-containing key
cmd/cogs/main.go Bumps version number to reflect the bug fix

@jproffitt jproffitt merged commit 4d9c6d1 into master Jul 28, 2025
9 checks passed
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.

3 participants