Skip to content

run interpolation after merge, but for required attributes#651

Merged
ndeloof merged 1 commit intocompose-spec:mainfrom
ndeloof:interpolate_after_merge
Jul 8, 2024
Merged

run interpolation after merge, but for required attributes#651
ndeloof merged 1 commit intocompose-spec:mainfrom
ndeloof:interpolate_after_merge

Conversation

@ndeloof
Copy link
Copy Markdown
Collaborator

@ndeloof ndeloof commented Jul 1, 2024

interpolation is ran after merge, so that a required missing variable, which is actually overridden, won't produce an error.

This is an alternative implementation based on #644:
This PR always run interpolation applying extends and include, but only on the relevant configuration structures. Global interpolation eventually takes places after merge

This has a minor impact on the loading process and schema: as we don't interpolate, we can't rely on a canonical model to enforce unicity after compose file merge, and doing so compose-spec schema uniqueItem constraint must be removed. This one anyway is just a syntactic sugar AFAICT that has no real impact on usability. From an IDE point of view, while obvious duplicate can be detected by schema, the non-obvious ones (like ports: ["8080", "${PORT}"] can't, and we still have to implement unicity check by the code

close docker/compose#11925

@ndeloof
Copy link
Copy Markdown
Collaborator Author

ndeloof commented Jul 1, 2024

see #652

@ndeloof ndeloof force-pushed the interpolate_after_merge branch from ce8a6c6 to ff5c904 Compare July 3, 2024 09:52
@ndeloof
Copy link
Copy Markdown
Collaborator Author

ndeloof commented Jul 3, 2024

checked by docker/compose#11961

@ndeloof ndeloof force-pushed the interpolate_after_merge branch from ff5c904 to 8fb901d Compare July 3, 2024 10:00
@ndeloof ndeloof requested review from glours and jhrotko July 3, 2024 10:16
Copy link
Copy Markdown
Collaborator

@jhrotko jhrotko left a comment

Choose a reason for hiding this comment

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

LGTM

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.

[BUG] Merge does not work properly with required variables

2 participants