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

Incorrect behavior when using default values for arguments #1266

Closed
shafreenAnfar opened this issue Apr 20, 2021 · 0 comments · Fixed by ballerina-platform/module-ballerina-graphql#192
Labels
module/graphql Issues related to Ballerina GraphQL module Team/PCM Protocol connector packages related issues Type/Bug

Comments

@shafreenAnfar
Copy link
Contributor

Consider the below program,

service /graphql on new graphql:Listener(9000) {
    resource function get allLifts(string status = "OPEN") returns Lift {
        TLift[] tLifts = from var l in liftTable where l.status == "OPEN" select l;
        return new Lift(tLifts[0]);  
    }
}

Results in below error

{
  "errors": [
    {
      "message": "Syntax Error: Cannot parse the unexpected character \".\".",
      "locations": [
        {
          "line": 7,
          "column": 9
        }
      ]
    }
  ]
}

For the query

{
  allLifts {
    name
    id
    trailAccess {
      name
    }
  }
}

Expected

{
  "data": {
    "allLifts": {
      "name": "Lift1",
      "id": "l1",
      "trailAccess": {
        "name": "tail1"
      }
    }
  }
}

Attached the complete program as well.

service.txt

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 Team/PCM Protocol connector packages related issues Type/Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant