Open ATMartin opened 4 years ago
Fresh eyes this morning have led me down the "camelCase" path. In 0.3.7, my schema resolves to looking for an imageRaw
field - which our API rejects as a non-existent field. This doesn't happen in 0.3.3.
It looks like this may be caused by things down in graphql
itself, in which case we're pinning graphlient
versions until I can convince the API team to do some work! Is there any way to disable this auto-camelcasing behavior at the Graphlient level?
It looks like this may be caused by things down in
graphql
itself, in which case we're pinninggraphlient
versions until I can convince the API team to do some work! Is there any way to disable this auto-camelcasing behavior at the Graphlient level?
AFAIK no, if you find a way to do this in the graphql-ruby client we should be able to expose it.
Graphql Ruby is camelCaseing by default to match GraphQL recommended naming approach, in our case, when you get response back it should already be snake_cased for you to access it in the response. So I would change image_raw
in your query to imageRaw
but when reading it from response you would still use image_raw
.
@ashkan18 I appreciate the suggestion! I believe the issue is that the API we're hitting does not camelCase their fields, so imageRaw
is rejected by the server as an invalid field.
I'd love to submit a PR for this! I've got finding a fix in graphql-ruby
(or graphql-client
) on my TODO list.
When updating from
graphlient
v0.3.3 to v0.3.7, I'm seeing an odd error:Here's a rough cut of the code resulting in this error:
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 richerGraphlient::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 newschema_path
option, but that appears to be optional.Interestingly, if I switch to the
image
property (which returns a URL to a compressed version ofimage_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-client
s changes with no luck. That said, I'm frustrated so my comprehension may be compromised.Regardless, thanks for this client!