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

Exposes compose loader.Transform function… #1244

Merged
merged 1 commit into from
Jul 31, 2018

Conversation

vdemeester
Copy link
Collaborator

This should make it easier for people to write custom composefile
parser without duplicating too much code. It takes the default
transformers and any additional number of transformer for any
types. That way it's possible to transform a cli/compose map into a
custom type that would use some of cli/compose types and its own.

Really useful to remove some duplication in docker/app 👼 🙏

Signed-off-by: Vincent Demeester [email protected]

@codecov-io
Copy link

codecov-io commented Jul 30, 2018

Codecov Report

Merging #1244 into master will decrease coverage by <.01%.
The diff coverage is 40%.

@@            Coverage Diff             @@
##           master    #1244      +/-   ##
==========================================
- Coverage   54.23%   54.23%   -0.01%     
==========================================
  Files         268      268              
  Lines       17807    17809       +2     
==========================================
  Hits         9658     9658              
- Misses       7542     7543       +1     
- Partials      607      608       +1

Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, but found a typo; I'll leave it to you to decide if you want to update or merge as-is 👍

@@ -265,11 +265,13 @@ func getServices(configDict map[string]interface{}) map[string]interface{} {
return map[string]interface{}{}
}

func transform(source map[string]interface{}, target interface{}) error {
// Transform convert the source map into the target struct with compose types transformer
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/convert/converts/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll fix 😉

This should make it easier for people to write custom composefile
parser without duplicating too much code. It takes the default
transformers and any additional number of transformer for any
types. That way it's possible to transform a `cli/compose` map into a
custom type that would use some of `cli/compose` types and its own.

Signed-off-by: Vincent Demeester <[email protected]>
@vdemeester vdemeester force-pushed the expose-compose-transform branch from ebe2821 to 0246bc1 Compare July 31, 2018 07:37
@thaJeztah thaJeztah merged commit 70d5cb0 into docker:master Jul 31, 2018
@GordonTheTurtle GordonTheTurtle added this to the 18.09.0 milestone Jul 31, 2018
@vdemeester vdemeester deleted the expose-compose-transform branch July 31, 2018 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants