Class: EasyTalk::Builders::ObjectBuilder
- Inherits:
-
BaseBuilder
- Object
- BaseBuilder
- EasyTalk::Builders::ObjectBuilder
- Extended by:
- T::Sig
- Defined in:
- lib/easy_talk/builders/object_builder.rb
Overview
Builder class for json schema objects.
Constant Summary collapse
- VALID_OPTIONS =
{ properties: { type: T::Hash[T.any(Symbol, String), T.untyped], key: :properties }, additional_properties: { type: T::Boolean, key: :additionalProperties }, subschemas: { type: T::Array[T.untyped], key: :subschemas }, required: { type: T::Array[T.any(Symbol, String)], key: :required }, defs: { type: T.untyped, key: :$defs }, allOf: { type: T.untyped, key: :allOf }, anyOf: { type: T.untyped, key: :anyOf }, oneOf: { type: T.untyped, key: :oneOf }, not: { type: T.untyped, key: :not } }.freeze
Constants inherited from BaseBuilder
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Attributes inherited from BaseBuilder
Instance Method Summary collapse
-
#initialize(schema_definition) ⇒ ObjectBuilder
constructor
A new instance of ObjectBuilder.
Methods inherited from BaseBuilder
Constructor Details
#initialize(schema_definition) ⇒ ObjectBuilder
Returns a new instance of ObjectBuilder.
26 27 28 29 30 31 32 |
# File 'lib/easy_talk/builders/object_builder.rb', line 26 def initialize(schema_definition) @schema_definition = schema_definition @schema = schema_definition.schema.dup @required_properties = [] name = schema_definition.name ? schema_definition.name.to_sym : :klass super(name, { type: 'object' }, , VALID_OPTIONS) end |
Instance Attribute Details
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
11 12 13 |
# File 'lib/easy_talk/builders/object_builder.rb', line 11 def schema @schema end |