mattkrick / cashay

:moneybag: Relay for the rest of us :moneybag:
MIT License
453 stars 28 forks source link

Schema conversion improvements #145

Open jverhoeven opened 7 years ago

jverhoeven commented 7 years ago

Your cashay client looks great, but got stuck at step 1 when trying to introspect/minimize my schema from my Django Graphql server (and thus had no JS GraphQLSchema file).

Changes: HTTP schema request requires application/json header (at least on some servers). When requested over HTTP, the schema is already introspected, so only minimize. Also allow introspected schema reading via file.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 76.305% when pulling 7cc33feacbe6491126a60a45b4490af59d532db6 on jverhoeven:master into 1ab2e45ab5b1c837a1de249d2514a86d16beb6d7 on mattkrick:master.

mattkrick commented 7 years ago

Thanks for the PR! At first glance this looks good, I've got some time to test it tomorrow night to see if it works in all cases. I'm curious how you were able to get rid of doing a require(foo).default after transpiling.

jverhoeven commented 7 years ago

Thanks. Regarding the require(foo).default I am afraid ignorance is bliss. I needed to just do a require without '.default' to allow already introspected JSON schemas as well. Did not run into problems myself, so let me know if this is an issue in use cases beyond my test scope.

theobat commented 7 years ago

Can I provide any help with tests to merge this PR ? doesn't seem like a big deal at first glance...

Thanks. Regarding the require(foo).default I am afraid ignorance is bliss. I needed to just do a require without '.default' to allow already introspected JSON schemas as well. Did not run into problems myself, so let me know if this is an issue in use cases beyond my test scope.

Perhaps we need tests in different context for the require ? I don't really see how to do that though