Skip to content

Camelcasing => ClientError between 0.3.3 & 0.3.7 #76

@ATMartin

Description

@ATMartin

When updating from graphlient v0.3.3 to v0.3.7, I'm seeing an odd error:

Graphlient::Errors::ClientError: Field 'image_raw' doesn't exist on type 'Resource'

Here's a rough cut of the code resulting in this error:

def query_for(user)
    @client = Graphlient::Client.new(my_cool_service_url)
    @client.query(my_query, { email: user.email })
end

def my_query
  <<~'GRAPHQL'
      query($email: String!) {
        user(email: $email) {
          registrations(first: 10) {
            edges {
              node {
                resource {
                  name
                  slug
                  image_raw
                }
                path {
                  progress
                  points {
                    total
                    earned
                  }
                }
              }
            }
          }
        }
      }
  GRAPHQL
end

Nothing's changed in our API & I can duplicate this error by changing nothing but the gem version.

I poked around a bit in IRB and found that I get back a generic Class from @client.schema in 0.3.7, whereas I see a much richer Graphlient::Schema object in 0.3.3. Has something changed in schema parsing that might cause this error? Am I missing a syntactic change I need to make? I did see the new schema_path option, but that appears to be optional.

Interestingly, if I switch to the image property (which returns a URL to a compressed version of image_raw), everything works fine. Maybe this property name is breaking a new rule? Our implementation includes a handful of other queries with similar failures in 0.3.7 that work on 0.3.3 & when directly posted via Insomnia.

I looked through the diff between these versions, as well as related issues/PRs, and didn't see anything right away that would cause this. Since most of it is delegated, I also browsed through graphql-clients changes with no luck. That said, I'm frustrated so my comprehension may be compromised.

Regardless, thanks for this client!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions