Kreya
Kreya copied to clipboard
nguid suggestion in autocomplete
In Visual Studio I use resharper. When I am writing a unittest and need a GUID, I can type nguid<tab>
to generate a GUID.
I think this might be a useful feature for Kreya.
Thank you for your request.
Do you need the guid to stay consistent across requests or do you want to have a new guid generated each time you send the request?
A shortcut to generate a consistent guid is currently not supported.
For the latter you could use {{ math.uuid }}
which provides a new guid for each request in the format 2dc55d50-3f6c-446a-87d0-a5a4eed23269
. If you need the guid in a different format, you could try manipulating it with the string functions of scriban. Support for the dotnet built in guid format identifiers will be added in Kreya 1.7.
The use case is this: I'm working on some system where a submit a request to create a resource with a specific guid, and then want to try and get the resource with the same guid a few times. I'm manually filling the request fields, but manually creating a guid is a bit of a hastle.
Would https://github.com/riok/Kreya/issues/23 address your use case?
The "Pre-request Script" in his example would be a decent workaround for what I'm describing. But I'm not very interested in the request chaining part, since I'm not using the tooling for repeated testing, merely for occasional requests to try an API once or twice.
Simply put, all I am looking for is to occasionally generate a guid at my cursor in the request so I can copy/paste it into a subsequent request, without going through the effort of scripting anything. See you guys got a nice autocomplete working, I think the nguid
thing I mentioned might be the easiest way (for the user) to works with these ids in non-scripted subsequent requests.
Using the pre-request script from #23 I could insert 1 unique guid in a request, but:
- If the request should contain multiple guids I cannot use this method.
- If the response does not contain the same guid, I cannot copy/paste the guid to a subsequent request.
Currently, I'm using the "Create GUID" tool provided by VS as a workaround.
By the way, in postman the variable {{$guid}}
is available which contains a unique guid for every use. But this has the same copy/paste caveat I mentioned before. (you can lookup the guid in the console log, but I wouldn't consider this user-friendly)
Now I got your use case :slightly_smiling_face: We may implement this in the future, but this feature isn't currently on our shortlist.
No worries, I really like what Kreya has to offer (especially authentication). This very much isn't isn't a blocking issue for my usage ;)