class Apicraft::Mocker::Number

Generate fake values for numbers

def enum

def enum
  schema.enum || []
end

def exclusive_maximum

def exclusive_maximum
  schema.exclusiveMaximum
end

def exclusive_minimum

def exclusive_minimum
  schema.exclusiveMinimum
end

def maximum

def maximum
  schema.maximum || 100
end

def minimum

def minimum
  schema.minimum || 1
end

def mock

def mock
  return enum.sample if enum.present?
  Faker::Number.between(
    from: schema.minimum || 1,
    to: schema.maximum || 100
  ) * multiple_of
end

def multiple_of

def multiple_of
  schema.multipleOf || 1
end