class SwaggerApi::ColumnSchema
Attributes
column[RW]
Public Instance Methods
create()
click to toggle source
# File lib/swagger_api/column_schema.rb, line 8 def create schema = default_schema if column.type == :integer schema[:minimum] = if column.name.to_s.ends_with?('id') 1 else 0 end end schema end
default_schema()
click to toggle source
# File lib/swagger_api/column_schema.rb, line 20 def default_schema { type: type_from_column, format: format_from_column } end
format_from_column()
click to toggle source
# File lib/swagger_api/column_schema.rb, line 37 def format_from_column case column.type when :datetime 'date-time' when :integer :int64 else if column.name.to_s == 'email' :email else column.type end end end
type_from_column()
click to toggle source
# File lib/swagger_api/column_schema.rb, line 27 def type_from_column if %i[datetime date time].include?(column.type) :string elsif %i[float double].include?(column.type) :number else column.type end end