Class: Graphql::Generators::InputGenerator
- Inherits:
-
TypeGeneratorBase
- Object
- Rails::Generators::NamedBase
- TypeGeneratorBase
- Graphql::Generators::InputGenerator
- Includes:
- FieldExtractor
- Defined in:
- lib/generators/graphql/input_generator.rb
Overview
Generate an input type by name, with the specified fields.
rails g graphql:object PostType name:string!
Class Method Summary collapse
Methods included from FieldExtractor
#column_type_string, #fields, #generate_column_string, #klass
Methods inherited from TypeGeneratorBase
Methods included from Core
#create_dir, #insert_root_type, #module_namespacing_when_supported, #schema_file_path
Class Method Details
.normalize_type_expression(type_expression, mode:, null: true) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/graphql/input_generator.rb', line 18 def self.normalize_type_expression(type_expression, mode:, null: true) case type_expression.camelize when "Text", "Citext" ["String", null] when "Decimal" ["Float", null] when "DateTime", "Datetime" ["GraphQL::Types::ISO8601DateTime", null] when "Date" ["GraphQL::Types::ISO8601Date", null] when "Json", "Jsonb", "Hstore" ["GraphQL::Types::JSON", null] else super end end |