Skip to content

Conversation

@Envek
Copy link

@Envek Envek commented Sep 20, 2018

Current examples in README.md are based on the syntax of graphql gem DSL before version 1.8.

After #11 was merged these examples aren't working anymore as currently, only modern syntax supported that use options hashes for DSL methods, like this:

  field :quantity, Integer, null: true,
                            preload: :variations,
                            preload_scope: ->(*) { VARIATION_RELATION },
                            description: "Virtual field. Sum of all variations' quantities"

I personally like old-fashioned definition blocks more. Especially for long things like descriptions:

  field :quantity, Integer, null: true do
    preload :variations
    preload_scope ->(*) { VARIATION_RELATION }

    description "Virtual field. Sum of all variations' quantities"
  end

In this PR I'm restoring old syntax so both above examples can be used interchangeably and even can be mixed together.

See related discussion starting from #11 (comment)

@RoryO, can you please take a look? If #14 will be merged first I will be glad to add specs for this syntax too.

@joeyparis
Copy link

Can this pull request be merged? It's the only thing prevent us from upgrading to the latest version of Graphql 1.8. Including this backwards compatability fits with the spirit of version 1.8 and the ability to upgrade over time. http://graphql-ruby.org/schema/class_based_api

@tjsingleton
Copy link

This pull request has been closed because it has not had recent activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants