class GraphQL::RakeTask
A rake task for dumping a schema as IDL or JSON.
By default, schemas are looked up by name as constants using schema_name:. You can provide a load_schema function to return your schema another way.
Use load_context: and visible? to dump schemas under certain visibility constraints.
Examples
Example: Dump a Schema to .graphql + .json files
require "graphql/rake_task" GraphQL::RakeTask.new(schema_name: "MySchema") # $ rake graphql:schema:dump # Schema IDL dumped to ./schema.graphql # Schema JSON dumped to ./schema.json
Example: Invoking the task from Ruby
require "rake" Rake::Task["graphql:schema:dump"].invoke
Example: Providing arguments to build the introspection query
require "graphql/rake_task" GraphQL::RakeTask.new(schema_name: "MySchema", include_is_one_of: true)
Constants
- DEFAULT_OPTIONS
Attributes
Returns
-
Array<String>
Returns
-
String— directory for IDL & JSON files
Returns
-
String— target for IDL task
Returns
-
Boolean— Options for additional fields in the introspection query JSON response
Returns
-
Boolean— Options for additional fields in the introspection query JSON response
Returns
-
Boolean— Options for additional fields in the introspection query JSON response
Returns
-
Boolean— Options for additional fields in the introspection query JSON response
Returns
-
Boolean— Options for additional fields in the introspection query JSON response
Returns
-
String— target for JSON task
Returns
-
<#call(task)>— A callable for loading the query context
Returns
-
<#call(task)>— A proc for loading the targetGraphQLschema
Returns
-
String— Namespace for generated tasks
See load_schema for loading a schema another way
Returns
-
String— By default, used to find the schema as a constant.
Public Class Methods
# File lib/graphql/rake_task.rb, line 115 def initialize(options = {}) all_options = DEFAULT_OPTIONS.merge(options) all_options.each do |k, v| self.public_send("#{k}=", v) end if block_given? yield(self) end define_task end
Set the parameters of this task by passing keyword arguments or assigning attributes inside the block