feat: add extensible transform API for custom field transformations#808
Conversation
b916851 to
ec2c08a
Compare
transform/defaults.go
Outdated
| var DefaultValues = map[tree.Path]TransformFunc{} | ||
|
|
||
| // For backward compatibility | ||
| var defaultValues = DefaultValues |
There was a problem hiding this comment.
not needed, as a non-public field there's no backward compatibility to be addressed here
transform/defaults.go
Outdated
| } | ||
|
|
||
| // RegisterDefaultTransformer registers a custom transformer for the given path pattern | ||
| func RegisterDefaultTransformer(path string, transformer TransformFunc) { |
There was a problem hiding this comment.
RegisterDefaultTransformer sounds weird to me. What about RegisterDefaultValue
transform/defaults.go
Outdated
| } | ||
|
|
||
| // GetDefaultTransformers returns a copy of the current default transformers | ||
| func GetDefaultTransformers() map[string]TransformFunc { |
There was a problem hiding this comment.
why have this function while DefaultValues is public ?
|
Can you please squash your commits, rebase and sign-off, so we can merge ? |
af372c9 to
6bf03b7
Compare
|
Hey @ndeloof
|
|
seems you included way more than the expected changes in your commit :') |
|
I see,It seems something broke after I rebased main |
d981d63 to
de3bbc1
Compare
|
@ndeloof fixed |
transform/canonical.go
Outdated
| // TransformFunc is a function that can transform data at a specific path | ||
| type TransformFunc func(data any, p tree.Path, ignoreParseError bool) (any, error) | ||
|
|
||
| // For backward compatibility |
de3bbc1 to
dade8b5
Compare
Head branch was pushed to by a user without write access
c153775 to
cc0c190
Compare
|
Linter complains about "stuttering" when using type as I refactored some naming: |
c22999a to
79a2dfe
Compare
Yes, I think that's a good idea I added a test and an example function |
glours
left a comment
There was a problem hiding this comment.
LGTM, thanks a lot for this contribution 🙏
Signed-off-by: Evgenii Orlov <[email protected]>
dd88e9a to
3aed6c5
Compare
This enables users to extend compose-go with custom protocols and validation logic without forking the project, addressing the need for custom port protocols like http/https and domain name support
example:
Related issue: psviderski/uncloud#44