Skip to content

Complex variable type definitions and validations #237

@pseudomorph

Description

@pseudomorph

Describe the solution you'd like

Current type specifications do not allow for complex definition of list and map types. Furthermore, validators are mostly centered on string type validations.

Seems that there's opportunity to implement a richer typing and validation framework.

It might be possible to implement this by extending the current framework. Perhaps something like the following:

.i.e.:

variable:
  - name: list-of-ints
     type: list[int]
     validations:
       - required
       - length-1-100 # length of list
       - each:
          - max-1000 # max int value
  - name: map-of-ints
     type: map[string, int]
     validations:
       - key:
         - alpha
       - each:
          - max-1000 # max int value
  - name: map-of-lists-of-strings
     type: map[string, list[string]]
     validations:
       - required
       - key:
          - alpha
       - each:
          - each:
             - email

But it might be worth taking a step back and considering other implementations.

This could also be an opportunity to look for a better maintained validation library, as https://github.com/go-ozzo/ozzo-validation/ hasn't been updated in 5 years.

Let me know if there is value here!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions