Class: Jsapi::Meta::Schema::String

Inherits:
Base show all
Includes:
Conversion
Defined in:
lib/jsapi/meta/schema/string.rb

Constant Summary

Constants included from Model::Attributes

Model::Attributes::DEFAULT_ARRAY, Model::Attributes::DEFAULT_HASH

Instance Attribute Summary

Attributes inherited from Base

#validations

Instance Method Summary collapse

Methods included from Conversion

#convert, included

Methods inherited from Base

#default, #default_value, #deprecated, #description, #enum, #enum=, #examples, #existence, #external_docs, #initialize, #nullable?, #omittable?, #title, #type

Methods included from OpenAPI::Extensions

included

Methods inherited from Model::Base

#initialize, #inspect, #merge!, #reference?, #resolve

Methods included from Model::Attributes

#attribute, #attribute_names

Constructor Details

This class inherits a constructor from Jsapi::Meta::Schema::Base

Instance Method Details

#formatObject

:attr: format The format of a string.



12
# File 'lib/jsapi/meta/schema/string.rb', line 12

attribute :format, ::String

#max_lengthObject

:attr: max_length The maximum length of a string.



17
# File 'lib/jsapi/meta/schema/string.rb', line 17

attribute :max_length, accessors: %i[reader]

#max_length=(value) ⇒ Object

:nodoc:



29
30
31
32
# File 'lib/jsapi/meta/schema/string.rb', line 29

def max_length=(value) # :nodoc:
  add_validation('max_length', Validation::MaxLength.new(value))
  @max_length = value
end

#min_lengthObject

:attr: min_length The minimum length of a string.



22
# File 'lib/jsapi/meta/schema/string.rb', line 22

attribute :min_length, accessors: %i[reader]

#min_length=(value) ⇒ Object

:nodoc:



34
35
36
37
# File 'lib/jsapi/meta/schema/string.rb', line 34

def min_length=(value) # :nodoc:
  add_validation('min_length', Validation::MinLength.new(value))
  @min_length = value
end

#patternObject

:attr: pattern The regular expression a string must match.



27
# File 'lib/jsapi/meta/schema/string.rb', line 27

attribute :pattern, accessors: %i[reader]

#pattern=(value) ⇒ Object

:nodoc:



39
40
41
42
# File 'lib/jsapi/meta/schema/string.rb', line 39

def pattern=(value) # :nodoc:
  add_validation('pattern', Validation::Pattern.new(value))
  @pattern = value
end

#to_json_schemaObject

:nodoc:



44
45
46
# File 'lib/jsapi/meta/schema/string.rb', line 44

def to_json_schema # :nodoc:
  format ? super.merge(format: format) : super
end

#to_openapiObject

:nodoc:



48
49
50
# File 'lib/jsapi/meta/schema/string.rb', line 48

def to_openapi(*) # :nodoc:
  format ? super.merge(format: format) : super
end