fix: reject ambiguous legacy documents - #35
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 422853e155
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // type errors from callers that must avoid destructive conversions. | ||
| func GetYamlDataStrict(input string) (yamlConfig Define.YAMLOutput, err error) { | ||
| err = yaml.Unmarshal([]byte(input), &yamlConfig) | ||
| err = yaml.UnmarshalStrict([]byte(input), &yamlConfig) |
There was a problem hiding this comment.
Preserve valid YAML merge-key overrides
When a legacy map uses a YAML merge key and then explicitly overrides one of the merged entries—for example global: {<<: *defaults, User: bob}—yaml.UnmarshalStrict reports the explicit User as a duplicate and rejects the document. YAML merge semantics permit explicit keys to override merged values, and the previous decoder accepted these files, so existing legacy configurations using anchors can no longer be converted; duplicate detection needs to distinguish literal duplicate keys from merge overrides.
Useful? React with 👍 / 👎.
Summary
Verification
go test ./...go test -race ./...go vet ./...git diff --check