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

Fix object/map field stitching #447

Conversation

mattjohnsonpint
Copy link
Member

@mattjohnsonpint mattjohnsonpint commented Oct 10, 2024

Description

Fixes an issue where an output object with a nested output object wasn't being materialized correctly.

For example, a function returning a map of maps:

export function testMapOfMaps(): Map<string, Map<string, f64>> {
  const m = new Map<string, Map<string, f64>>();
  const inner = new Map<string, f64>();
  inner.set("a", 1);
  inner.set("b", 2);
  m.set("inner", inner);
  return m;
}

The error caused the internal input template to only provide the root map's key and value fields. The result of filling that template would then be a GraphQL error, such as:

{ "errors": [
        {
            "message": "Array cannot represent non-array value.",
            "path": [
                "testMapOfMaps",
                0,
                "value",
                "value"
            ]
        }
    ]
}

The root cause turned out to be a simple struct copy issue.

No tests, because we still need to make a test suite for the GraphQL datasource.

Checklist

  • Code compiles correctly and linting passes locally
  • Tests for new functionality and regression tests for bug fixes added
  • Documentation added or updated
  • Entry added to the CHANGELOG.md file describing and linking to this PR

@mattjohnsonpint mattjohnsonpint requested a review from a team as a code owner October 10, 2024 00:03
@mattjohnsonpint mattjohnsonpint changed the title Mjp/hyp 2385 returning map of map causes array cannot represent non array Fix object/map field stitching Oct 10, 2024
@mattjohnsonpint mattjohnsonpint enabled auto-merge (squash) October 10, 2024 00:20
@mattjohnsonpint mattjohnsonpint added this to the v0.13.0 milestone Oct 10, 2024
jairad26
jairad26 previously approved these changes Oct 10, 2024
@mattjohnsonpint mattjohnsonpint merged commit 07548db into main Oct 10, 2024
75 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/hyp-2385-returning-map-of-map-causes-array-cannot-represent-non-array branch October 10, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants