Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make External a boolean #480

Merged
merged 1 commit into from
Nov 21, 2023
Merged

make External a boolean #480

merged 1 commit into from
Nov 21, 2023

Conversation

ndeloof
Copy link
Collaborator

@ndeloof ndeloof commented Nov 3, 2023

For legacy reason (i.e Docker Swarm) external at some point has been defined as a struct, then deprecated to get back to a plain boolean using parent name to retrieve an existing resource.
As we manage transformation in plain yaml we can now manage this legacy without having the go structs to reflect this weird heritage.
This PR changes types.External definition to be a plain boolean, and handle name relocation during the "transform" phase.
Also removes the weird assumption an external resource will have always name set, even this is just the same as the one defined by the mapping keys

@ndeloof ndeloof requested review from glours and milas November 3, 2023 10:01
}
return []byte(fmt.Sprintf(`{"name": %q}`, e.Name)), nil
}
type External bool
Copy link
Member

Choose a reason for hiding this comment

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

Should we get rid of this type def entirely?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

conversion is implicit as shown on https://github.com/compose-spec/compose-go/pull/480/files#diff-e03e88bd30c556736d10afdd0ba283743f9f6146e57b31cfef159e00e178af8dR491 so having an explicit type here has no cost and offers an opportunity for a receiver to define backward compatibility func is needed

Signed-off-by: Nicolas De Loof <[email protected]>
@ndeloof ndeloof merged commit 593b777 into compose-spec:main Nov 21, 2023
8 checks passed
@ndeloof ndeloof deleted the external_bool branch November 21, 2023 07:41
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.

2 participants