-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
This is just an idea, but it could be valuable.
Have a small collection of declarative validators that can be specified directly in the spec. Validators are simply functions that evaluate to Bool
and are applied to the value that was parsed successfully. For example range
or compare
for numbers and other Ord
things, length
for strings and lists, eg:
port:
etc/spec:
default: 3000
type: number
validators:
- lte:
value: 0
error: "Ports with non-positive values don't make sense"
- gt:
value: 65535
error: "Port numbers are 16-bit"
- lt:
value: 1024
warn: "Using system level port, root privilege will be necessary"
Metadata
Metadata
Assignees
Labels
No labels