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

Input types missing default values #254

Closed
benzolium opened this issue Feb 26, 2024 · 2 comments · Fixed by #256
Closed

Input types missing default values #254

benzolium opened this issue Feb 26, 2024 · 2 comments · Fixed by #256

Comments

@benzolium
Copy link
Contributor

benzolium commented Feb 26, 2024

When I (or frontend lib) query merged schema:

{
  __type(name:"someName"){
    kind
    name
    inputFields {
      defaultValue
      name
    }
  }
}

I'm getting null as default values, tho I actually have some:

{
  "data": {
    "__type": {
      "kind": "INPUT_OBJECT",
      "name": "someName",
      "inputFields": [
        {
          "defaultValue": null,
          "name": "name"
        },
        {
          "defaultValue": null,
          "name": "description"
        },
      ]
    }
  }
}

I've reproduced it in a test: a7c3cbe.
I want to fix it, but I don't know, where to start. @pkqk, maybe you could guide me?
I've already checked gqlparser - it looks fine.
I have also written a test in merge_test.go and it's passing, but I have doubts because CheckSuccess helper is a bit complicated.

@andyyu2004
Copy link
Contributor

Hey @benzolium, relevant code is in resolveField and generally resolve* functions in executable_schema.go. Let me know if you need some further guidance on the implementation.

@benzolium
Copy link
Contributor Author

Thanks @andyyu2004! I might be confused with "defaultValue" case in resolveInputValue so I've overlooked it.
PR with a fix is ready.

@pkqk pkqk closed this as completed in #256 Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants