Skip to content

fix(config): Fix printing of flattened nested lists and maps#655

Merged
JeanMertz merged 2 commits into
mainfrom
prr223
May 18, 2026
Merged

fix(config): Fix printing of flattened nested lists and maps#655
JeanMertz merged 2 commits into
mainfrom
prr223

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

When a config field is flattened (#[serde(flatten)]), its key segment should not be pushed onto the field path, since flattened fields don't occupy their own level in the config hierarchy. Previously, the field key was always pushed regardless of flattening, causing incorrect paths in error reporting.

Additionally, nested list and map iteration now tracks the index or key at each level — lists enumerate their items so the numeric index can be appended to the path, and maps append the map key — giving precise field paths for errors inside nested collections.

As an example, previously, if a tool config had an invalid source config, errors would incorrectly report paths such as conversation.tools.tools.source. Now they correctly print conversation.tools.<tool-name>.source.

JeanMertz added 2 commits May 18, 2026 11:06
When a config field is flattened (`#[serde(flatten)]`), its key segment
should not be pushed onto the field path, since flattened fields don't
occupy their own level in the config hierarchy. Previously, the field
key was always pushed regardless of flattening, causing incorrect paths
in error reporting.

Additionally, nested list and map iteration now tracks the index or key
at each level — lists enumerate their items so the numeric index can be
appended to the path, and maps append the map key — giving precise field
paths for errors inside nested collections.

As an example, previously, if a tool config had an invalid `source`
config, errors would incorrectly report paths such as
`conversation.tools.tools.source`. Now they correctly print
`conversation.tools.<tool-name>.source`.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit c972d98 into main May 18, 2026
14 checks passed
@JeanMertz JeanMertz deleted the prr223 branch May 18, 2026 09:21
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.

1 participant