Skip to content

Basic config value validation #62

@lehins

Description

@lehins

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions