Module: GraphQL::Schema::Printer::TypeKindPrinters::DeprecatedPrinter

Included in:
EnumPrinter, FieldPrinter
Defined in:
lib/graphql/schema/printer.rb

Instance Method Summary collapse

Instance Method Details



155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/graphql/schema/printer.rb', line 155

def print_deprecated(field_or_enum_value)
  return unless field_or_enum_value.deprecation_reason

  case field_or_enum_value.deprecation_reason
  when nil
    ''
  when '', GraphQL::Directive::DEFAULT_DEPRECATION_REASON
    ' @deprecated'
  else
    " @deprecated(reason: #{field_or_enum_value.deprecation_reason.to_s.inspect})"
  end
end