Skip to content

Weird error when loading a dynamic property of a type #140

Open
@Dracks

Description

Hello,

I'm trying to migrate my project MrScrooge from nestjs with graphql into swift with vapor, graphqlkit (which uses graphiti), And seems I've got some issue, not sure if it's my error or is an error on graphiti.

When I add a dynamic field into a type, to load only when I've got the request, I do it as following:

Type(MyProfile.self){
   Field("group", MyProfile.groups
}
MyProfile{
   func groups(request: Request, Parent: MyProfile){}
}

You can see this here:
Dracks/mr-scrooge@27862ab#diff-86900d9223aa878afd6fd2f942cdd076fa63c7a147fae5e22db15769e0d2ec95R63
and here:

Dracks/mr-scrooge@27862ab#diff-86900d9223aa878afd6fd2f942cdd076fa63c7a147fae5e22db15769e0d2ec95R136-R141

it ends crashing in some weird error, the error is the following:

{
  "errors": [
    {
      "message": "keyNotFound(CodingKeys(stringValue: \"id\", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: \"No value associated with key CodingKeys(stringValue: \\\"id\\\", intValue: nil) (\\\"id\\\").\", underlyingError: nil))",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "me",
        "groups"
      ]
    }
  ]
}```

I look with xcode, it seem to be some error parsing the session. Any Idea of what it can be? It happens in multiple places I've got the dynamic field. 

Do you need some small example? I can try to create it. 

Thanks, 
Dracks

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions