feat: support for predefined variables (WIP) #3886
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Important
This is a WIP. I try working on this every weekend, hence the slow progress. The branch will always be up-to-date. If you don't want to wait and are willing to contribute to this PR feel free to checkout the branch and commit (
feat/predefined-variable
).References
Closes #3317
Description
Note: Tidy this PR description when work in this PR is finished
The idea is to introduce a feature similar to:
This feature is being built based on the work done for https://docs.hoppscotch.io/documentation/getting-started/rest/environment-variables.
Checks
Additional Information
Remarks
$guid
while$guid
is a predefined variable that computes to a random GUID, the request parser will use the predefined variable over your manually defined variable.Demonstration
This video demonstrates the use of a Predefined variable in Hoppscotch. At the first instance you will see a usage of a normal environment variable
myvar
, and after that the video shows the use of a predefined variable called$nowIso
which computes to the current time at the time of request. After that, the video also shows the usage of another predefined variable called$guid
that computes to a random GUID value (noting that for demonstrations purposed the GUID value is just a simple string random string).The video also shows a green border with green background on hover highlighting a valid predefined variable, while a red border with a red hover background is shown highlighting an invalid predefined variable. Hovering over a predefined variable name, a brief description is shown.
ScreenRecording2024-03-10at21.46.26-ezgif.com-video-to-gif-converter.mov