{"action":"created","issue":{"url":"https://api.github.com/repos/tomhoule/graphql-client/issues/60","repository_url":"https://api.github.com/repos/tomhoule/graphql-client","labels_url":"https://api.github.com/repos/tomhoule/graphql-client/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/tomhoule/graphql-client/issues/60/comments","events_url":"https://api.github.com/repos/tomhoule/graphql-client/issues/60/events","html_url":"https://github.com/tomhoule/graphql-client/pull/60","id":340342713,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwNzc3ODQ2","number":60,"title":"WIP - Implicitly discover schema and query without macro attributes","user":{"login":"brainlessdeveloper","id":16181067,"node_id":"MDQ6VXNlcjE2MTgxMDY3","avatar_url":"https://avatars1.githubusercontent.com/u/16181067?v=4","gravatar_id":"","url":"https://api.github.com/users/brainlessdeveloper","html_url":"https://github.com/brainlessdeveloper","followers_url":"https://api.github.com/users/brainlessdeveloper/followers","following_url":"https://api.github.com/users/brainlessdeveloper/following{/other_user}","gists_url":"https://api.github.com/users/brainlessdeveloper/gists{/gist_id}","starred_url":"https://api.github.com/users/brainlessdeveloper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brainlessdeveloper/subscriptions","organizations_url":"https://api.github.com/users/brainlessdeveloper/orgs","repos_url":"https://api.github.com/users/brainlessdeveloper/repos","events_url":"https://api.github.com/users/brainlessdeveloper/events{/privacy}","received_events_url":"https://api.github.com/users/brainlessdeveloper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-07-11T17:47:23Z","updated_at":"2018-07-11T21:53:58Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/tomhoule/graphql-client/pulls/60","html_url":"https://github.com/tomhoule/graphql-client/pull/60","diff_url":"https://github.com/tomhoule/graphql-client/pull/60.diff","patch_url":"https://github.com/tomhoule/graphql-client/pull/60.patch"},"body":"So, this is the most naïve implementation I could fathom. Current problems:\r\n\r\n1. `to_snake_case` won't take care of numbers. In the existing example, `Query1` is snake-cased as `query1` but the file name was `query_1`. I suppose this is not a big issue.\r\n2. `implicitly_discover_schema_name` is extremely verbose, I suppose you can come up with some nicer way of writing this.\r\n3. This assumes there's `src/`. There should probably be another approach, and I'd like to store those magic strings somewhere nicer.\r\n4. I'm probably using some archaic way of manipulating strings."},"comment":{"url":"https://api.github.com/repos/tomhoule/graphql-client/issues/comments/404322784","html_url":"https://github.com/tomhoule/graphql-client/pull/60#issuecomment-404322784","issue_url":"https://api.github.com/repos/tomhoule/graphql-client/issues/60","id":404322784,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDMyMjc4NA==","user":{"login":"brainlessdeveloper","id":16181067,"node_id":"MDQ6VXNlcjE2MTgxMDY3","avatar_url":"https://avatars1.githubusercontent.com/u/16181067?v=4","gravatar_id":"","url":"https://api.github.com/users/brainlessdeveloper","html_url":"https://github.com/brainlessdeveloper","followers_url":"https://api.github.com/users/brainlessdeveloper/followers","following_url":"https://api.github.com/users/brainlessdeveloper/following{/other_user}","gists_url":"https://api.github.com/users/brainlessdeveloper/gists{/gist_id}","starred_url":"https://api.github.com/users/brainlessdeveloper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brainlessdeveloper/subscriptions","organizations_url":"https://api.github.com/users/brainlessdeveloper/orgs","repos_url":"https://api.github.com/users/brainlessdeveloper/repos","events_url":"https://api.github.com/users/brainlessdeveloper/events{/privacy}","received_events_url":"https://api.github.com/users/brainlessdeveloper/received_events","type":"User","site_admin":false},"created_at":"2018-07-11T21:53:58Z","updated_at":"2018-07-11T21:53:58Z","author_association":"NONE","body":"So for the schema we could follow something like this:\r\n\r\n0. Use the macro attribute.\r\n1. Try to parse `.graphqlconfig` and find it from there (maybe it's worth trying to have a file dedicated to handling stuff from `.graphqlconfig`?).\r\n2. If it's not there, try to find it in the project root next to `Cargo.toml`.\r\n3. Otherwise try to find it in `${root}/src/`.\r\n4. Fail. \r\n\r\nFor the query files, I'm thinking defaulting to `${root}/src/` is not the best idea, because most projects will have query files somewhere else in the code. Maybe (if not too magic) something like this would work:\r\n\r\n0. Use the macro attribute.\r\n1. Try to find the file searching the directory from which the macro was called, and recurse parent directories until the project root. Maybe also take into account `includes` and `excludes` from `.graphqlconfig`? Not sure if this would be worth it.\r\n2. Fail.\r\n\r\nIn any case, we could just start by using the defaults you've suggested. What do you think?"}}
{"actor":{"display_login":"brainlessdeveloper"}}