Class: Odin::Types::SchemaField

Inherits:
Object
  • Object
show all
Defined in:
lib/odin/types/schema.rb

Overview

Schema field definition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, field_type:, required: false, nullable: false, redacted: false, deprecated: false, constraints: [], conditionals: [], default_value: nil, description: nil, computed: false, immutable: false, type_ref: nil) ⇒ SchemaField

Returns a new instance of SchemaField.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/odin/types/schema.rb', line 116

def initialize(name:, field_type:, required: false, nullable: false,
               redacted: false, deprecated: false, constraints: [],
               conditionals: [], default_value: nil, description: nil,
               computed: false, immutable: false, type_ref: nil)
  @name = name.freeze
  @field_type = field_type
  @required = required
  @nullable = nullable
  @redacted = redacted
  @deprecated = deprecated
  @constraints = constraints.freeze
  @conditionals = conditionals.freeze
  @default_value = default_value
  @description = description&.freeze
  @computed = computed
  @immutable = immutable
  @type_ref = type_ref&.freeze
  freeze
end

Instance Attribute Details

#computedObject (readonly)

Returns the value of attribute computed.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def computed
  @computed
end

#conditionalsObject (readonly)

Returns the value of attribute conditionals.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def conditionals
  @conditionals
end

#constraintsObject (readonly)

Returns the value of attribute constraints.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def constraints
  @constraints
end

#default_valueObject (readonly)

Returns the value of attribute default_value.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def default_value
  @default_value
end

#deprecatedObject (readonly)

Returns the value of attribute deprecated.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def deprecated
  @deprecated
end

#descriptionObject (readonly)

Returns the value of attribute description.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def description
  @description
end

#field_typeObject (readonly)

Returns the value of attribute field_type.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def field_type
  @field_type
end

#immutableObject (readonly)

Returns the value of attribute immutable.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def immutable
  @immutable
end

#nameObject (readonly)

Returns the value of attribute name.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def name
  @name
end

#nullableObject (readonly)

Returns the value of attribute nullable.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def nullable
  @nullable
end

#redactedObject (readonly)

Returns the value of attribute redacted.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def redacted
  @redacted
end

#requiredObject (readonly)

Returns the value of attribute required.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def required
  @required
end

#type_refObject (readonly)

Returns the value of attribute type_ref.



112
113
114
# File 'lib/odin/types/schema.rb', line 112

def type_ref
  @type_ref
end