Skip to content

Commit

Permalink
fix: Avoid duplicated requestable fields (sourcenetwork#1621)
Browse files Browse the repository at this point in the history
## Relevant issue(s)

Resolves sourcenetwork#1615

## Description

Makes sure the requestable fields aren't duplicated
  • Loading branch information
islamaliev authored Jul 12, 2023
1 parent a0f3ffe commit 557e898
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions planner/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ func resolveInnerFilterDependencies(
) ([]Requestable, error) {
newFields := []Requestable{}

sourceLoop:
for key := range source {
if strings.HasPrefix(key, "_") && key != request.KeyFieldName {
continue
Expand Down Expand Up @@ -844,6 +845,11 @@ func resolveInnerFilterDependencies(
// If the key index is outside the bounds of the child mapping array, then
// this is not a relation/join and we can add it to the fields and
// continue (no child props to process)
for _, field := range existingFields {
if field.GetIndex() == keyIndex {
continue sourceLoop
}
}
newFields = append(existingFields, &Field{
Index: keyIndex,
Name: key,
Expand Down

0 comments on commit 557e898

Please sign in to comment.