Sha256: 41a5bd5bcff11f26afd781107dcb2d040070398d2d6bd31216b1c3835e00d08f

Contents?: true

Size: 796 Bytes

Versions: 129

Compression:

Stored size: 796 Bytes

Contents

# frozen_string_literal: true
require 'generators/graphql/type_generator'

module Graphql
  module Generators
    # Generate an interface type by name,
    # with the specified fields.
    #
    # ```
    # rails g graphql:interface NamedEntityType name:String!
    # ```
    class InterfaceGenerator < TypeGeneratorBase
      desc "Create a GraphQL::InterfaceType with the given name and fields"
      source_root File.expand_path('../templates', __FILE__)

      argument :fields,
        type: :array,
        default: [],
        banner: "name:type name:type ...",
        desc: "Fields for this interface (type may be expressed as Ruby or GraphQL)"

      def create_type_file
        template "interface.erb", "#{options[:directory]}/types/#{type_file_name}.rb"
      end
    end
  end
end

Version data entries

129 entries across 129 versions & 2 rubygems

Version Path
graphql_cody-1.13.0 lib/generators/graphql/interface_generator.rb
graphql-1.12.24 lib/generators/graphql/interface_generator.rb
graphql-1.13.6 lib/generators/graphql/interface_generator.rb
graphql-1.13.5 lib/generators/graphql/interface_generator.rb
graphql-1.13.4 lib/generators/graphql/interface_generator.rb
graphql-1.13.3 lib/generators/graphql/interface_generator.rb
graphql-1.12.23 lib/generators/graphql/interface_generator.rb
graphql-1.13.2 lib/generators/graphql/interface_generator.rb
graphql-1.13.1 lib/generators/graphql/interface_generator.rb
graphql-1.12.22 lib/generators/graphql/interface_generator.rb
graphql-1.13.0 lib/generators/graphql/interface_generator.rb
graphql-1.12.21 lib/generators/graphql/interface_generator.rb
graphql-1.12.20 lib/generators/graphql/interface_generator.rb
graphql-1.12.19 lib/generators/graphql/interface_generator.rb
graphql-1.11.10 lib/generators/graphql/interface_generator.rb
graphql-1.12.18 lib/generators/graphql/interface_generator.rb
graphql-1.11.9 lib/generators/graphql/interface_generator.rb
graphql-1.12.17 lib/generators/graphql/interface_generator.rb
graphql-1.12.16 lib/generators/graphql/interface_generator.rb
graphql-1.12.15 lib/generators/graphql/interface_generator.rb