Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved GraphQL client #672

Merged
merged 3 commits into from
Jan 24, 2020
Merged

Improved GraphQL client #672

merged 3 commits into from
Jan 24, 2020

Commits on Jan 24, 2020

  1. Improved GraphQL client

    This is a complete rewrite of the GraphQL client functionality.
    
    The previous implementation suffered from a few problems making it
    virtually unusable as detailed in
    #511. Here's a summary:
    
    1. you couldn't specify a local schema file
    2. due to the above, the client made a dynamic introspection request on
    initialization which was very slow
    3. unbounded memory growth due to building new clients at runtime
    
    This rewrite was focused on solving those problems first and foremost
    but we also had a few other goals:
    
    * support API versioning
    * provide better defaults and an improved developer experience
    * ensure it's impossible to do the wrong thing
    
    The new GraphQL client *only* supports loading local schema files to
    ensure no introspection requests are made during app runtime. The goal
    is that clients are fully initialized at application boot time (and if
    you're using Rails this is handled automatically).
    
    Workflow:
    1. Set `ShopifyAPI::GraphQL.schema_location` to a directory path (or
    use the default in Rails of `db/shopify_graphql_schemas`).
    2. Save a JSON version of Shopify's Admin schema locally (or use the
    `shopify_api:graphql:dump` Rake task) to the `schema_location` and name
    it after the API version: `2020-01.json`.
    3. Access the client at `ShopifyAPI::GraphQL.client`
    4. Execute queries via `client.query`
    swalkinshaw committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    8883785 View commit details
    Browse the repository at this point in the history
  2. Add documentation

    swalkinshaw committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    b87b06b View commit details
    Browse the repository at this point in the history
  3. Improve rake task

    * Fixes Rails `environment` task prereq
    * Does a preflight request to ensure authentication works
    * Improved output
    swalkinshaw committed Jan 24, 2020
    Configuration menu
    Copy the full SHA
    de79d8c View commit details
    Browse the repository at this point in the history