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

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

Instance Method Summary collapse

Instance Method Details


80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/graphql/schema/printer.rb', line 80

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