This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
Add optional
key to config values as mutually-exclusive with default
#25
Labels
It is sometimes handy to use the presence of a scalar to trigger some conditional behavior. For example: a
radius
, which when set will add the flag--radius
to the algorithm's command-line invocation.This conflicts with the manifest's need to provide firm assurances to the gear as to the structure of data it will be provided. For example: many languages cannot distinguish between a set, falsey / zero value, an unset value, or a null value. This ambiguity would make it difficult or impossible to correctly process a manifest.
So: let's make it opt-in. The
optional
key marks that a value may or may not be present at all in theconfig.json
. This is mutually-exclusive withdefault
, since it would be ambiguous to resolve the two.Caveat: Depending the interface a consumer uses, an optional string value may not be very helpful. For example: in the web interface, empty strings should be sent if not filled out. @lmperry and I discussed this and it seems fair that since the algorithm opted into this, it's reasonable to have it deal with that.
This value is always provided, and defaults to zero:
This value is only provided if set, including zero:
This value is (probably) always provided by a web interface, and provided if set by a CLI interface:
The text was updated successfully, but these errors were encountered: