Improved API docs autogeneration
This commit is contained in:
@@ -7,14 +7,14 @@ module Graphqlable
|
||||
self.name.gsub('::', '_').underscore.to_sym
|
||||
end
|
||||
|
||||
def graphql_pluralized_field_name
|
||||
self.name.gsub('::', '_').underscore.pluralize.to_sym
|
||||
end
|
||||
|
||||
def graphql_field_description
|
||||
"Find one #{self.model_name.human} by ID"
|
||||
end
|
||||
|
||||
def graphql_pluralized_field_name
|
||||
self.name.gsub('::', '_').underscore.pluralize.to_sym
|
||||
end
|
||||
|
||||
def graphql_pluralized_field_description
|
||||
"Find all #{self.model_name.human.pluralize}"
|
||||
end
|
||||
|
||||
@@ -61,6 +61,18 @@ module ActsAsTaggableOn
|
||||
|)
|
||||
end
|
||||
|
||||
def self.graphql_field_name
|
||||
:tag
|
||||
end
|
||||
|
||||
def self.graphql_pluralized_field_name
|
||||
:tags
|
||||
end
|
||||
|
||||
def self.graphql_type_name
|
||||
'Tag'
|
||||
end
|
||||
|
||||
private
|
||||
def custom_counter_field_name_for(taggable_type)
|
||||
"#{taggable_type.underscore.pluralize}_count"
|
||||
|
||||
@@ -46,7 +46,7 @@ module GraphQL
|
||||
fields.each do |field_name, field_type|
|
||||
case ApiTypesCreator.type_kind(field_type)
|
||||
when :scalar
|
||||
field(field_name, SCALAR_TYPES[field_type])
|
||||
field(field_name, SCALAR_TYPES[field_type], model.human_attribute_name(field_name))
|
||||
when :singular_association
|
||||
field(field_name, -> { api_types_creator.created_types[field_type] }) do
|
||||
resolve -> (object, arguments, context) do
|
||||
|
||||
Reference in New Issue
Block a user