[Question] How to declare required fields?
See original GitHub issueHi, I’m trying out hydra right now because I like having sane defaults and the (java spring-config like) flexibility to configure everything. Looks good so far! 😃
I have a CLI app that has two required fields that need to be provided by the user and can’t have defaults. I want to use strict mode, so I declared those in my config file. But if I leave them empty, I get None
as the value. Is there a way to mark those as required like in argparse and have hydra print usage/help if they are not delivered?
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Marking Required Fields in Forms - Nielsen Norman Group
The solution is simple: mark all the required fields. Be as explicit and transparent as possible: for every single field that must be...
Read more >How to make question a required field? - Jotform
It seems you want to make a question required field. You may like to take a look at the following guide which should...
Read more >How to perform form validation for a required field in HTML
1. Required attribute: If you want to make an input mandatory to be entered by the user, you can use the required attribute....
Read more >Required Field - Wufoo Help
When you make a field required, people must enter an answer to the field in order to submit their entry. When someone tries...
Read more >How to make some fields mandatory in a questionnaire
creating a new field. Step 2: Choose a field type. · field types NutriAdmin · make this field required · example tick box...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Jonas, Thanks for your interest in Hydra! Do read the documentation of OmegaConf, it will help you understand what you can do with Hydra.
specifically for your question, you can specify required field with the string
???
(but really, go through the docs 😃 ).Look at the debugging section in the tutorial. What you want to use is the composition trace to understand how your config was actually composed.
Specific answer to your question: Config groups are mutually exclusive, there can be only one env. and that would be the last env, so prod. you want to put your scaffolding somewhere else, either in a different config group or in the default.yaml file itself (composition order will show you that it’s being composed before the rest of your config group, but after the hydra config groups, allowing you to override hydra from it, but also override it from your config groups.