Class: EasyTalk::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_talk/configuration.rb

Constant Summary collapse

SCHEMA_VERSIONS =

JSON Schema draft version URIs

{
  draft202012: 'https://json-schema.org/draft/2020-12/schema',
  draft201909: 'https://json-schema.org/draft/2019-09/schema',
  draft7: 'http://json-schema.org/draft-07/schema#',
  draft6: 'http://json-schema.org/draft-06/schema#',
  draft4: 'http://json-schema.org/draft-04/schema#'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration



17
18
19
20
21
22
23
24
# File 'lib/easy_talk/configuration.rb', line 17

def initialize
  @default_additional_properties = false
  @nilable_is_optional = false
  @auto_validations = true
  @schema_version = :none
  @schema_id = nil
  @use_refs = false
end

Instance Attribute Details

#auto_validationsObject

Returns the value of attribute auto_validations.



14
15
16
# File 'lib/easy_talk/configuration.rb', line 14

def auto_validations
  @auto_validations
end

#default_additional_propertiesObject

Returns the value of attribute default_additional_properties.



14
15
16
# File 'lib/easy_talk/configuration.rb', line 14

def default_additional_properties
  @default_additional_properties
end

#nilable_is_optionalObject

Returns the value of attribute nilable_is_optional.



14
15
16
# File 'lib/easy_talk/configuration.rb', line 14

def nilable_is_optional
  @nilable_is_optional
end

#schema_idObject

Returns the value of attribute schema_id.



14
15
16
# File 'lib/easy_talk/configuration.rb', line 14

def schema_id
  @schema_id
end

#schema_versionObject

Returns the value of attribute schema_version.



14
15
16
# File 'lib/easy_talk/configuration.rb', line 14

def schema_version
  @schema_version
end

#use_refsObject

Returns the value of attribute use_refs.



14
15
16
# File 'lib/easy_talk/configuration.rb', line 14

def use_refs
  @use_refs
end

Instance Method Details

#schema_uriObject

Returns the URI for the configured schema version, or nil if :none



27
28
29
30
31
# File 'lib/easy_talk/configuration.rb', line 27

def schema_uri
  return nil if @schema_version == :none

  SCHEMA_VERSIONS[@schema_version] || @schema_version.to_s
end