Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add wildcard support for json files #52

Open
BennyAlex opened this issue Jul 14, 2020 · 6 comments
Open

[Feature Request] Add wildcard support for json files #52

BennyAlex opened this issue Jul 14, 2020 · 6 comments

Comments

@BennyAlex
Copy link

BennyAlex commented Jul 14, 2020

Hello,

it would be cool if the wildcard is passed into the json files to, so { id: __project_uuid__ } will return the current uuid.

Maybe the wildcard needs some type of escaping, eg: $__project_uuid__$

This would reduce the usage of more complicated js files.

@muratcorlu
Copy link
Owner

Hi,

That's a good one. And also doesn't seem very difficult to implement. The most important part deciding a notation for variables in json files. I'll think about it. Any other suggestions and even PRs are very welcome.

@BennyAlex
Copy link
Author

BennyAlex commented Jul 14, 2020

json needs for all keys/values strings, so maybe __id__ without quotes is enough

@BennyAlex
Copy link
Author

BennyAlex commented Jul 14, 2020

you are already introduced a wildcard notation with double underscore, so you probably fine using it again

@muratcorlu
Copy link
Owner

I'm not sure about "not using" quotes because in that case json files will be invalid and it can disturb people on editors or some linters. Maybe

{
  "id": "__id__"
}

will be also good and safe enough.

@BennyAlex
Copy link
Author

yeah you are right. Another cool thing would be usage of simple expressions

{ 'doubleID': 'mockExpresion(__uuid__ * 2)' }

where 'mockExpresion' indicates the value is an expression

@BennyAlex
Copy link
Author

BennyAlex commented Jul 14, 2020

But {"id": "__id__"}
would be already nice and I think its okay to turn it on by default, but maybe the user can disable it with an option passed to the mock config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants