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

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

Constant Summary

Constants inherited from Base

Base::TYPES

Instance Attribute Summary

Attributes inherited from Base

#validations

Instance Method Summary collapse

Methods included from Conversion

#convert

Methods inherited from Base

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

Methods inherited from Base

#initialize, #inspect, #reference?, #resolve

Methods included from Attributes::ClassMethods

#attribute, #attribute_names

Constructor Details

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

Instance Method Details

#formatObject

:attr: format The optional format of a string. Possible values are:

  • "date"

  • "date-time"



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

attribute :format, ::String, values: %w[date date-time]

#max_lengthObject

:attr: max_length The maximum length of a string.



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

attribute :max_length, writer: false

#max_length=(value) ⇒ Object

:nodoc:



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

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.



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

attribute :min_length, writer: false

#min_length=(value) ⇒ Object

:nodoc:



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

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.



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

attribute :pattern, writer: false

#pattern=(value) ⇒ Object

:nodoc:



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

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

#to_json_schemaObject

:nodoc:



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

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

#to_openapiObject

:nodoc:



52
53
54
# File 'lib/jsapi/meta/schema/string.rb', line 52

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