bbbco / insomnia-plugin-faker

Faker Plugin for Insomnia REST Client
71 stars 7 forks source link

Random.ArrayElement question #1

Closed jaredmeakin closed 6 years ago

jaredmeakin commented 6 years ago

Hiyas!

I'm having some trouble getting Faker.Random.ArrayElement to work. When using this method in Faker you just pass it in an Array, and an item from that array is randomly selected. I've tried passing one into the Modifier field, but no luck no matter how I format it.

Any thoughts on how I can do this? Thanks for the awesome plugin!

bbbco commented 6 years ago

Hey @jaredmeakin I'm glad you like the plugin!

Unfortunately, I don't think that we are going to be able to support the Faker.Random.ArrayElement method because I am limited with how that modifier textbox coerces the value to a string before passing it along to the actual run method. This is a limitation of the Insomnia plugin system at the time.

Maybe at some point down the road other options will become available? The only other thing I can think of is to analyze the modifier variable that gets passed in to run and see if we can coerce it back to an appropriate type before sending it to the Faker method.

If you have other ideas, feel free to submit a PR!