diff --git a/CHANGELOG.md b/CHANGELOG.md index b204e24..1f8c545 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### (Next) * Your contribution here. * [#113](https://github.com/ashkan18/graphlient/pull/113): Fix CI builds - [@yuki24](https://github.com/yuki24). +* [#112](https://github.com/ashkan18/graphlient/pull/112): Update graphql-client github repository links in README - [@th1988](https://github.com/th1988). ### 0.8.0 (2024/01/06) * [#110](https://github.com/ashkan18/graphlient/pull/110): Ensure correct Faraday JSON response body parsing with invalid response header - [@taylorthurlow](https://github.com/taylorthurlow). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index afdf49f..6e75124 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ We definitely appreciate pull requests that highlight or reproduce a problem, ev Implement your feature or bug fix. -Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ingored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`. +Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ignored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`. Make sure that `bundle exec rake` completes without errors. diff --git a/README.md b/README.md index a48a6a2..9789209 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ A friendlier Ruby client for consuming GraphQL-based APIs. Built on top of your - [Create API Client Classes with Graphlient::Extension::Query](#create-api-client-classes-with-graphlientextensionquery) - [Swapping the HTTP Stack](#swapping-the-http-stack) - [Testing with Graphlient and RSpec](#testing-with-graphlient-and-rspec) -- [License](#license) +- [License](#license) ## Installation @@ -46,7 +46,7 @@ client = Graphlient::Client.new('https://test-graphql.biz/graphql', ``` | http_options | default | type | -|---------------|---------|---------| +| ------------- | ------- | ------- | | read_timeout | nil | seconds | | write_timeout | nil | seconds | @@ -216,7 +216,9 @@ client.query(ids: [42]) do end end ``` + Graphlient supports following Scalar types for parameterized queries by default: + - `:id` maps to `ID` - `:boolean` maps to `Boolean` - `:float` maps to `Float` @@ -244,7 +246,6 @@ end You can `parse` and `execute` queries separately with optional variables. This is highly recommended as parsing a query and validating a query on every request adds performance overhead. Parsing queries early allows validation errors to be discovered before request time and avoids many potential security issues. - ```ruby # parse a query, returns a GraphQL::Client::OperationDefinition query = client.parse do @@ -279,7 +280,7 @@ client.execute query, ids: [42] ### Dynamic vs. Static Queries -Graphlient uses [graphql-client](https://github.com/github/graphql-client), which [recommends](https://github.com/github/graphql-client/blob/master/guides/dynamic-query-error.md) building queries as static module members along with dynamic variables during execution. This can be accomplished with graphlient the same way. +Graphlient uses [graphql-client](https://github.com/github-community-projects/graphql-client), which [recommends](https://github.com/github-community-projects/graphql-client/blob/master/guides/dynamic-query-error.md) building queries as static module members along with dynamic variables during execution. This can be accomplished with graphlient the same way. Create a new instance of `Graphlient::Client` with a URL and optional headers. @@ -321,7 +322,7 @@ Execute the query. response = SWAPI::Client.execute(SWAPI::InvoiceQuery, id: 42) ``` -Note that in the example above the client is created with `allow_dynamic_queries: false` (only allow static queries), while graphlient defaults to `allow_dynamic_queries: true` (allow dynamic queries). This option is marked deprecated, but we're proposing to remove it and default it to `true` in [graphql-client#128](https://github.com/github/graphql-client/issues/128). +Note that in the example above the client is created with `allow_dynamic_queries: false` (only allow static queries), while graphlient defaults to `allow_dynamic_queries: true` (allow dynamic queries). This option is marked deprecated, but we're proposing to remove it and default it to `true` in [graphql-client#128](https://github.com/github-community-projects/graphql-client/issues/128). ### Generate Queries with Graphlient::Query @@ -342,7 +343,7 @@ query.to_s ### Use of Fragments -[Fragments](https://github.com/github/graphql-client#defining-queries) should be referred by constant: +[Fragments](https://github.com/github-community-projects/graphql-client#defining-queries) should be referred by constant: ```ruby module Fragments @@ -373,7 +374,7 @@ end ``` The wrapped response only allows access to fields that have been explicitly asked for. -In this example, while `id` has been referenced directly in the main query, `feeInCents` has been spread via fragment and trying to access it in the original wrapped response will throw [`GraphQL::Client::ImplicitlyFetchedFieldError`](https://github.com/github/graphql-client/blob/master/guides/implicitly-fetched-field-error.md) (to prevent data leaks between components). +In this example, while `id` has been referenced directly in the main query, `feeInCents` has been spread via fragment and trying to access it in the original wrapped response will throw [`GraphQL::Client::ImplicitlyFetchedFieldError`](https://github.com/github-community-projects/graphql-client/blob/master/guides/implicitly-fetched-field-error.md) (to prevent data leaks between components). ```ruby response = client.execute(invoice_query) diff --git a/lib/graphlient/client.rb b/lib/graphlient/client.rb index 6ee9844..16d618d 100644 --- a/lib/graphlient/client.rb +++ b/lib/graphlient/client.rb @@ -27,7 +27,7 @@ def execute(query, variables = nil) query = client.parse(query) if query.is_a?(String) rc = client.query(query, **query_params) raise Graphlient::Errors::GraphQLError, rc if rc.errors.any? - # see https://github.com/github/graphql-client/pull/132 + # see https://github.com/github-community-projects/graphql-client/pull/132 # see https://github.com/exAspArk/graphql-errors/issues/2 raise Graphlient::Errors::ExecutionError, rc if errors_in_result?(rc) rc