Skip to content

chore(dev): migrate GenerateConfig trait to serde_json::Value - #25964

Open
pront wants to merge 3 commits into
masterfrom
pront-generate-config-multi-format-roundtrip
Open

chore(dev): migrate GenerateConfig trait to serde_json::Value#25964
pront wants to merge 3 commits into
masterfrom
pront-generate-config-multi-format-roundtrip

Conversation

@pront

@pront pront commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

GenerateConfig::generate_config() returned toml::Value due to TOML being Vector's original config format. This migrates it to serde_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-clippy and make fmt pass clean. 99 files changed.

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

@github-actions github-actions Bot added domain: sources Anything related to the Vector's sources domain: transforms Anything related to Vector's transform components domain: sinks Anything related to the Vector's sinks labels Jul 28, 2026
@pront pront changed the title refactor(dev): migrate GenerateConfig trait from toml::Value to serde_json::Value chore(dev): migrate GenerateConfig trait to serde_json::Value Jul 28, 2026
@pront
pront marked this pull request as ready for review July 28, 2026 20:05
@pront
pront requested a review from a team as a code owner July 28, 2026 20:05
@datadog-vectordotdev

datadog-vectordotdev Bot commented Jul 28, 2026

Copy link
Copy Markdown

Pipelines  Tests

⚠️ Warnings

🚦 4 Pipeline jobs failed

Test Suite | test / Tests   View in Datadog   GitHub Actions

🧪 20 Tests failed

config::cmd::tests::output_has_consistent_ordering from vector   View in Datadog
Test has failed
config::cmd::tests::output_is_a_valid_config from vector   View in Datadog
Test has failed
View all failed tests

Changelog | validate-changelog   View in Datadog   GitHub Actions

PR Title Check | Check PR Title   View in Datadog   GitHub Actions

View all 4 failed jobs.

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 223b72b | Docs | Datadog PR Page | Give us feedback!

@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: 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()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Strip nulls before serializing generated TOML

When a default config contains an unskipped Option::None—for example, Appsignal's default tlsserde_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 👍 / 👎.

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

Labels

domain: sinks Anything related to the Vector's sinks domain: sources Anything related to the Vector's sources domain: transforms Anything related to Vector's transform components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide generic generate_config and test_generate_config

2 participants