Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a graphql_client_web crate for browser usage #174
Conversation
This comment has been minimized.
This comment has been minimized.
|
@h-michael As you can see there is a lot of work left, but if you want to review that would be welcome :) |
tomhoule
force-pushed the
graphql-client-web
branch
from
49e09ef
to
6c05e72
Oct 17, 2018
This comment has been minimized.
This comment has been minimized.
|
@tomhoule Thanks for mentioning to me! |
tomhoule
force-pushed the
graphql-client-web
branch
from
6c05e72
to
b6c286a
Oct 18, 2018
| use wasm_bindgen::JsValue; | ||
| use wasm_bindgen_test::*; | ||
|
|
||
| use std::panic; |
This comment has been minimized.
This comment has been minimized.
|
|
||
| assert_eq!(continent_name, "Europe"); | ||
| }).map_err(|err| { | ||
| panic!("{:?}", err); |
This comment has been minimized.
This comment has been minimized.
| #[test] | ||
| fn client_new() { | ||
| Client::new("https://example.com/graphql"); | ||
| Client::new("/graphql"); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -0,0 +1,35 @@ | |||
| [package] | |||
| name = "graphql_client_web" | |||
| version = "0.1.0" | |||
This comment has been minimized.
This comment has been minimized.
h-michael
Oct 22, 2018
Contributor
You said that all the crates have same version.
Is this crate exception?
This comment has been minimized.
This comment has been minimized.
| /// - (optionally) configure it | ||
| /// - use it to perform queries with the [call] method | ||
| pub struct Client { | ||
| endpoint: String, |
This comment has been minimized.
This comment has been minimized.
| /// - (optionally) configure it | ||
| /// - use it to perform queries with the [call] method | ||
| pub struct Client { | ||
| endpoint: String, |
This comment has been minimized.
This comment has been minimized.
h-michael
Oct 22, 2018
Contributor
You have already said at the description, I think client is able to have header attributes.
| /// | ||
| /// not exhaustive | ||
| #[derive(Debug, Fail)] | ||
| #[non_exhaustive] |
This comment has been minimized.
This comment has been minimized.
h-michael
Oct 22, 2018
Contributor
You should add #![feature(non_exhaustive)], otherwise I can't build.
This comment has been minimized.
This comment has been minimized.
| @@ -1,9 +1,9 @@ | |||
| [workspace] | |||
| members = [ | |||
| "graphql_client_cli", | |||
| "graphql_client_codegen", | |||
| "graphql_client", | |||
| "graphql_client/examples/example_module", | |||
| "graphql_client/examples/github", | |||
| "graphql_query_derive", | |||
This comment has been minimized.
This comment has been minimized.
tomhoule
force-pushed the
graphql-client-web
branch
from
309a562
to
146be14
Nov 13, 2018
This comment has been minimized.
This comment has been minimized.
|
Out of curiosity, why will this be a separate crate rather than a normal feature? |
This comment has been minimized.
This comment has been minimized.
|
It only works on a specific target (wasm32-unknown-unknown) so it looked like it would be complicated to configure. It also has a very specific setup for tests so it seemed to make sense to make it a separate crate. If the configuration is straightforward we could reexport graphql-client-web as a feature on graphql-client easily, so I don't really see any big drawback to making it a separate crate. I'm open to other ideas of course :) |
This comment has been minimized.
This comment has been minimized.
|
Also as a more general comment, we want client crates for many different platforms (probably graphql-client-node, graphql-client-async, graphql-client-sync, ...) so I didn't want to clutter the core crate too much. |
This comment has been minimized.
This comment has been minimized.
|
I just realized reexporting from graphql_client wouldn't work because this crate depends on the types from graphql_client. That's a usability problem. |
This comment has been minimized.
This comment has been minimized.
|
There is some similiar discussion going on here: seanmonstar/reqwest#288 |
tomhoule
force-pushed the
graphql-client-web
branch
2 times, most recently
from
eb94cce
to
952d04b
Dec 19, 2018
tomhoule
added some commits
Oct 17, 2018
tomhoule
force-pushed the
graphql-client-web
branch
4 times, most recently
from
a559799
to
a13eec1
Dec 19, 2018
This comment has been minimized.
This comment has been minimized.
|
Just wanted to say: I tried out this branch on a wasm project, and it works like a charm. |
tomhoule commentedOct 17, 2018
•
edited
What needs to be done before this is mergeable:
ClientErrorenum non-exhaustive