lib/fakeit/openapi/example/string_example.rb in fakeit-0.4.2 vs lib/fakeit/openapi/example/string_example.rb in fakeit-0.5.0
- old
+ new
@@ -8,19 +8,21 @@
'email' => -> { 'some@email.com' },
'date' => -> { Date.today.iso8601 },
'date-time' => lambda do
now = Time.now
Time.new(now.year, now.month, now.day, 0, 0, 0, now.utc_offset).iso8601
- end
+ end,
+ 'binary' => -> { '1111' }
}.freeze
RANDOM_FORMAT_HANDLERS = {
'uri' => -> { Faker::Internet.url },
'uuid' => -> { SecureRandom.uuid },
'guid' => -> { SecureRandom.uuid },
'email' => -> { Faker::Internet.email },
'date' => -> { Faker::Date.backward(days: 100).iso8601 },
- 'date-time' => -> { Faker::Time.backward(days: 100).iso8601 }
+ 'date-time' => -> { Faker::Time.backward(days: 100).iso8601 },
+ 'binary' => -> { Faker::String.random(length: (4..100).step(4)) }
}.freeze
def string_example(example_options)
if example_options[:use_static][type: 'string', property: example_options[:property]]
static_string_example