chore(dev): migrate GenerateConfig trait to serde_json::Value - #25964
chore(dev): migrate GenerateConfig trait to serde_json::Value#25964pront wants to merge 3 commits into
serde_json::Value#25964Conversation
serde_json::Value
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 223b72bc18
ℹ️ 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".
| fn generate_config() -> toml::value::Value { | ||
| toml::value::Value::try_from(&Self::default()).unwrap() | ||
| fn generate_config() -> serde_json::Value { | ||
| serde_json::to_value(&Self::default()).unwrap() |
There was a problem hiding this comment.
Strip nulls before serializing generated TOML
When a default config contains an unskipped Option::None—for example, Appsignal's default tls—serde_json::to_value preserves it as JSON null. The generated value is later passed to toml::to_string by generate_example, which rejects that value as an unsupported unit, so commands such as vector generate //appsignal --format toml now fail instead of producing a config. The previous toml::Value::try_from omitted these fields, so null-valued fields need to be removed or otherwise normalized before TOML serialization.
Useful? React with 👍 / 👎.
Summary
GenerateConfig::generate_config()returnedtoml::Valuedue to TOML being Vector's original config format. This migrates it toserde_json::Value, which is the stated direction in #19963 (drop TOML as an internal value type).Vector configuration
N/A
How did you test this PR?
make check-clippyandmake fmtpass clean. 99 files changed.Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
generate_configandtest_generate_config#21865