Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mandatory answer and weird behavior with no default value

See original GitHub issue

The documentation says: default: Leave empty to force the user to answer.

When not specifying the default key, the default value is None; perfect.
But the prompt shows 🎤 [None]:.
I think it should be 🎤 : maybe with above that VAR_NAME? Required. Format: str

When pressing enter, it should not accept an empty answer and should ask again (i.e. force the user to enter a value… as mandatory, and as described in the doc)

Currently, if pressing enter, that variable is None and using it in another default value “as a string”, if becomes the string"None"… which is a known “problem” with Jinja (or Django templates at least).
Wouldn’t it be better to use an empty string "" rather than None (for str variables)?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

eyllanesccommented, Jan 22, 2022

I think that the “default” field should not be used to indicate that the answer is required, a field called “required” or “mandatory” should be created, if the “default” field is used then it is equivalent to required=false but an empty string in the default field should not imply required=true since in some cases the default value may be an empty string. Also the “required” field should be true by default.

And if the “validator” field is implemented then it should work together with that field.

csadorfcommented, Sep 28, 2022

We have validators now in 6.2. Have you tried with those?

I had not, thank you for pointing this out. This does constitute a viable work-around for the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expectation/Request: "default" implies "required" #407 - GitHub
It's possible the behavior is localized to this context, and that the default value is set in e.g. the decorated function. I haven't...
Read more >
Default value not working for Property Validation Rule
Hello Experts, We use properties under Request/Incident/Problem Area. I created a property and associated with a Property validation rule ...
Read more >
Should switch statements always contain a default clause?
Switch cases should almost always have a default case. Reasons to use a default. 1.To 'catch' an unexpected value
Read more >
ScriptRunner Behaviours - default description overwritten
I have a problem with an initialiser behaviour setting the default description. Note that this only occurs when the create issue screen is ......
Read more >
Unassigned Data Source and Mandatory Query Variables ...
The behavior of the script is a little strange indeed. If you assign a default value or if the mandatory variable has a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found