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

Support transforming maps in Data Contract rules #1324

Merged
merged 2 commits into from
Oct 29, 2024
Merged

Conversation

rayokota
Copy link
Member

Support transforming maps in Data Contract rules. Previously only transforming fields in structs were supported. This PR adds ability to transform entries in maps.

@rayokota rayokota requested review from a team as code owners October 28, 2024 16:48
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

@@ -238,6 +255,9 @@ func disjoint(slice1 []string, map1 map[string]bool) bool {
}

func getField(msg *reflect.Value, name string) (*reflect.Value, error) {
if msg.Kind() != reflect.Struct {
return nil, fmt.Errorf("message is not a struct")
Copy link
Member

Choose a reason for hiding this comment

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

why not do the same thing as above
val.MapIndex(reflect.ValueOf(propName)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. This method is only for operating on Structs

Copy link
Member

@kcorman0 kcorman0 left a comment

Choose a reason for hiding this comment

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

LGTM assuming build pass

@rayokota rayokota merged commit 8d502ae into master Oct 29, 2024
1 of 2 checks passed
@rayokota rayokota deleted the map-in-rules branch October 29, 2024 02:01
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