Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vektah
Copy link
Collaborator

@vektah vektah commented Nov 28, 2018

When answering introspection queries we were returning objects like this:

 {
          "kind": "OBJECT",
          "name": "Chatroom",
          "description": "",
          "fields": [
            {
              "name": "name",
              "description": "",
              "args": [
                
              ],
              "type": {
                "kind": "NON_NULL",
                "name": null,
                "ofType": {
                  "kind": "SCALAR",
                  "name": "String",
                  "ofType": null
                }
              },
              "isDeprecated": false,
              "deprecationReason": ""
            },
            {
              "name": "messages",
              "description": "",
              "args": [
                
              ],
              "type": {
                "kind": "NON_NULL",
                "name": null,
                "ofType": {
                  "kind": "LIST",
                  "name": null,
                  "ofType": {
                    "kind": "NON_NULL",
                    "name": null,
                    "ofType": {
                      "kind": "OBJECT",
                      "name": "Message",
                      "ofType": null
                    }
                  }
                }
              },
              "isDeprecated": false,
              "deprecationReason": ""
            }

deprecationReason: ""

This PR changes introspection to return null instead.

Fixes #436

I have:

  • Added tests covering the bug / feature (see testing)

@vektah vektah force-pushed the fix-deprecated-fields branch from 6694438 to b365333 Compare November 28, 2018 06:52
@vektah vektah merged commit 3a7f37c into master Nov 28, 2018
@ghost
Copy link

ghost commented Nov 29, 2018

After this merge to master, my code is returning following error while playground is executing query IntrospectionQuery {.....}

panic: interface conversion: interface {} is func() bool, not bool

goroutine 181 [running]:
github/a/b/graph/exec.(*executionContext).___Field_isDeprecated(0xc00035ed10, 0xd2e440, 0xc0003bb9e0, 0xc0002cfa00, 0x0, 0x0, 0x0, 0xc00035c4c8, 0x0, 0x0)
        /go/src/github/a/b/graph/exec/generated.go:13776 +0x541
github/a/b/graph/exec.(*executionContext).___Field(0xc00035ed10, 0xd2e440, 0xc0003bb9e0, 0xc0002df140, 0xc, 0xc, 0xc00035c4c8, 0x0, 0xc000417748)
        /go/src/github/a/b/graph/exec/generated.go:13592 +0x9a6
github/a/b/graph/exec.(*executionContext).___Type_fields.func2.1(0xc00035ed10, 0xd2e440, 0xc0003bb9e0, 0xc0002cf780, 0xc0002df140, 0xc, 0xc, 0xc00035c480, 0x2, 0x2, ...)
        /go/src/github/a/b/graph/exec/generated.go:14390 +0x91
github/a/b/graph/exec.(*executionContext).___Type_fields.func2(0x1)
        /go/src/github/a/b/graph/exec/generated.go:14391 +0xb3
created by github/a/b/graph/exec.(*executionContext).___Type_fields
        /go/src/github/a/b/graph/exec/generated.go:14396 +0x6c4

@vektah
Copy link
Collaborator Author

vektah commented Nov 29, 2018

You need to regenerate after updating gqlgen

@vvakame vvakame deleted the fix-deprecated-fields branch November 30, 2018 03:18
RenovZ pushed a commit to RenovZ/gqlgen that referenced this pull request Mar 25, 2022
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 this pull request may close these issues.

2 participants