Skip to content

refactored to rely on yaml.Node during parsing#854

Open
ndeloof wants to merge 3 commits intocompose-spec:mainfrom
ndeloof:yaml.Node
Open

refactored to rely on yaml.Node during parsing#854
ndeloof wants to merge 3 commits intocompose-spec:mainfrom
ndeloof:yaml.Node

Conversation

@ndeloof
Copy link
Collaborator

@ndeloof ndeloof commented Mar 13, 2026

The existing compose file loading pipeline uses map[string]any as its intermediate representation, which loses YAML source location information (file, line number). This makes it impossible to produce precise error messages pointing to the offending line in the source file.

It also forces interpolation and path resolution to happen eagerly, with a single global environment, even though include directives can specify per-file env_file and project_directory.

This PR introduces a new loading path to build a ComposeModel backed by raw *yaml.Node trees. Each node is associated with a NodeContext that captures the environment variables, working directory, and source filename from its originating file. All normalization (interpolation, type casting, path resolution) is deferred until Resolve() is called.

This also allows to get rid of mapstructure dependency an rely on UnmarshallYAML function to cover type conversions

ndeloof added 2 commits March 13, 2026 17:06
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof ndeloof force-pushed the yaml.Node branch 4 times, most recently from 93cfb69 to 855edb9 Compare March 15, 2026 14:23
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
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