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

Suggestion: Allow certain fields to be optional: true #15

Open
Qqwy opened this issue Jun 17, 2020 · 0 comments
Open

Suggestion: Allow certain fields to be optional: true #15

Qqwy opened this issue Jun 17, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@Qqwy
Copy link
Owner

Qqwy commented Jun 17, 2020

The idea is as follows:

  • When a field has no default set, it is marked as required and Specify will raise when nothing ends up being passed.
  • When a field has a default set, this is what Specify will fall back to.
  • When optional: true is set (and there is no default set), Specify will accept the value nil on top of what the field parser accepts, and will use this as fallback-value.

I encountered the usefulness of this while writing Blocked.Config where most of the fields are optional. Since Specify currently does not accept nil as default when the parser e.g. is string or boolean, this becomes a problem.

@Qqwy Qqwy added the enhancement New feature or request label Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant