vscode-restclient icon indicating copy to clipboard operation
vscode-restclient copied to clipboard

Feature/faker support

Open SjaaLom opened this issue 4 years ago • 6 comments

With the addition of faker.js to the systemVariableProvider it is possible to generate realistic test data in your requests.

post http://localhost:8081/api/person

{
  "firstName": "{{$faker name.firstName}}",
  "lastName": "{{$faker name.lastName}}",
  "phone": "{{$faker phone.phoneNumber}}",
  "email": "{{$faker internet.email}}",
  "bio": "{{$faker lorum.words}}"
}

For API documentation of Faker.js and full code see: https://github.com/marak/faker.js

SjaaLom avatar Mar 29 '21 08:03 SjaaLom

Hi, I would like to merge this faker.js support into the main REST client, to make it easy to create realistic test data in requests. Please consider this contribution and if you have any questions, just let me know.

SjaaLom avatar Mar 29 '21 08:03 SjaaLom

@SjaaLom is there autocomplete for the different definitions from faker? (name.firstName, name.lastName...) and if not, would it be possible to add that?

Meir017 avatar Mar 29 '21 08:03 Meir017

It does not yet have autocomplete for that. I'm sure it would be possible to add it. The one drawback would be that you would then be forced to maintain that and keep it in sync with the faker api. What it does now is just pass the expression to faker and let it figure it out. I think the addition of this feature alone is already a great bonus. But I will definitely take a look what it would take to add autocomplete, although I would prefer to create a separate pull request for that.

SjaaLom avatar Mar 29 '21 09:03 SjaaLom

This would be a great feature. Is there any reason this can't/shouldn't be merged?

codeandcats avatar Sep 12 '22 03:09 codeandcats

This would be a great feature. Is there any reason this can't/shouldn't be merged?

There is nothing preventing it from being merged, but I wouldn’t hold my breath. Unfortunately, there has not been much action in this repo.

SjaaLom avatar Sep 13 '22 18:09 SjaaLom

@SjaaLom Would you replace faker with @faker-js/faker since it is no longer being maintained

marcobiedermann avatar Aug 30 '23 18:08 marcobiedermann