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

Cannot Pass null with GraphQL Variable Values #2696

Closed
DimuthuMadushan opened this issue Feb 17, 2022 · 0 comments · Fixed by ballerina-platform/module-ballerina-graphql#616
Assignees
Labels
module/graphql Issues related to Ballerina GraphQL module Points/3 Team/PCM Protocol connector packages related issues Type/Bug

Comments

@DimuthuMadushan
Copy link

Description:
When GraphQL service resource function has a nullable type input parameter, It should be able to pass null as the input value via variable json. But the service returns a validation error.

Consider the following service:

service on new graphql:Listener(9000) {
    resource function get name(string? name) returns string {
        if name is () {
            return "GraphQL";
        }
        return name;
    }
}

This can be queried using following content:

{
  "query": "query($name:String){ name(name:$name) }",
  "variables": { "name": null }
}

But this returns an error: Variable name expected value of type \"String\", found

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

Successfully merging a pull request may close this issue.

2 participants