module Praxis::Types::MediaTypeCommon::ClassMethods

Public Instance Methods

as_json_schema(**args) click to toggle source
# File lib/praxis/types/media_type_common.rb, line 10
def as_json_schema(**args)
  the_type = @attribute&.type || member_type
  the_type.as_json_schema(args)
end
description(text = nil) click to toggle source
# File lib/praxis/types/media_type_common.rb, line 20
def description(text = nil)
  @description = text if text
  @description
end
display_name(string = nil) click to toggle source
# File lib/praxis/types/media_type_common.rb, line 25
def display_name(string = nil)
  unless string
    return @display_name ||= name.split('::').last # Best guess at a display name?
  end

  @display_name = string
end
identifier(identifier = nil) click to toggle source

Get or set the identifier of this media type.

@return [MediaTypeIdentifier] the string-representation of this type’s identifier

# File lib/praxis/types/media_type_common.rb, line 36
def identifier(identifier = nil)
  return @identifier unless identifier

  @identifier = MediaTypeIdentifier.load(identifier)
end
json_schema_type() click to toggle source
# File lib/praxis/types/media_type_common.rb, line 15
def json_schema_type
  the_type = @attribute&.type || member_type
  the_type.json_schema_type
end