vscode-restclient
vscode-restclient copied to clipboard
Feature/faker support
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
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 is there autocomplete for the different definitions from faker? (name.firstName, name.lastName...) and if not, would it be possible to add that?
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.
This would be a great feature. Is there any reason this can't/shouldn't be merged?
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 Would you replace faker with @faker-js/faker since it is no longer being maintained