Uploaded image for project: 'Brooklyn'
  1. Brooklyn
  2. BROOKLYN-433

YAML-based config constraint to support regex

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.10.0
    • 0.11.0
    • None

    Description

      One can specify constraints on a config key's value, to give a validation error if an invalid value is supplied.

      In the Java code, this can be any predicate.

      However, in YAML we don't support many options. It would be good to support a regex constraint. For example:

      brooklyn.parameters:
      - name: address
        type: string
        constraints:
        - required
        - regex: ^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$
      

      See docs at https://raw.githubusercontent.com/apache/brooklyn-docs/master/guide/yaml/yaml-reference.md, and code at https://github.com/apache/brooklyn-server/blob/master/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java#L204-L205

      Attachments

        Activity

          People

            aled.sage Aled Sage
            aled.sage Aled Sage
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: