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

Resolver produces null when resolver returns a record containing a map of service objects as its field #3579

Closed
MohamedSabthar opened this issue Nov 1, 2022 · 1 comment · Fixed by ballerina-platform/module-ballerina-graphql#1024
Assignees
Labels
module/graphql Issues related to Ballerina GraphQL module Points/0.5 Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/PCM Protocol connector packages related issues Type/Bug
Milestone

Comments

@MohamedSabthar
Copy link
Member

Description:
Consider the following code

import ballerina/graphql;

public service class AccountDetails {
    final string name;
    final int createdYear;

    function init(string name, int createdYear) {
        self.name = name;
        self.createdYear = createdYear;
    }

    resource function get name() returns string {
        return self.name;
    }

    resource function get createdYear() returns int {
        return self.createdYear;
    }
}

public type AccountRecords record {|
    map<AccountDetails> details;
|};

service /graphql on new graphql:Listener(5001) {
    resource function get account() returns AccountRecords {
        return {details: {acc1: new ("James", 2022), acc2: new ("Paul", 2015)}};
    }
}

The above code returning {"data": null}
for the below query

{
  account {
    details(key:"acc1") {
      name
    }
  }
}

The expected value for the above query is

"data": {
    "account": {
        "details": {
            "name": "James"
        }
    }
}

Affected Versions:

OS, DB, other environment details and versions:

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):

@github-actions
Copy link

github-actions bot commented Nov 1, 2022

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/graphql Issues related to Ballerina GraphQL module Points/0.5 Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/PCM Protocol connector packages related issues Type/Bug
Projects
Archived in project
2 participants