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

feat: support for predefined variables (WIP) #3886

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kishannareshpal
Copy link

@kishannareshpal kishannareshpal commented Mar 10, 2024

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

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information

Remarks

  • Predefined variables takes precedence over manually defined environment / secret variables. E.g. If you define an environment / secret variable called $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

Copy link

sentry-io bot commented Mar 10, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: packages/hoppscotch-common/src/composables/codemirror.ts

Function Unhandled Issue
useCodemirror TypeError: Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or A... .r...
Event Count: 1 Affected Users: 2
useCodemirror TypeError: Cannot read properties of undefined (reading 'type') responseString(hoppscotch-common/src/components/gr...
Event Count: 1 Affected Users: 1

Did you find this useful? React with a 👍 or 👎

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

Successfully merging this pull request may close these issues.

[feature]: support system variables like GUID and UNIX Timestamp
1 participant