Grails
  1. Grails
  2. GRAILS-3802

Add custom constraints based on convetion

    Details

    • Type: New Feature New Feature
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.1-beta2
    • Fix Version/s: None
    • Component/s: Persistence
    • Labels:
      None

      Description

      Currently custom constraints can be added using the Config.groovy class as described inhttp://www.zorched.net/2008/01/26/custom-validators-in-grails-in-a-single-app/

      E.g.: org.codehaus.groovy.grails.validation.ConstrainedProperty.registerNewConstraint(
      PostalCodeConstraint.POSTAL_CODE_CONSTRAINT, PostalCodeConstraint.class)

      I think it would be great if constraints can be added by convention.
      E.g. add the PostcodeConstraint to some folder/package (utils?) and that Grails picks it up automatically and registers it. Just like it does it with the Codecs.

        Activity

        Marcel Overdijk created issue -
        Graeme Rocher made changes -
        Field Original Value New Value
        Fix Version/s 1.1-beta3 [ 14824 ]
        Priority Major [ 3 ] Critical [ 2 ]
        Graeme Rocher made changes -
        Fix Version/s 1.1-beta3 [ 14824 ]
        Fix Version/s 1.1-RC1 [ 14929 ]
        Hide
        Peter Ledbrook added a comment -

        No more new features for 1.1 at this juncture. Also, we don't consider this as critical.

        Show
        Peter Ledbrook added a comment - No more new features for 1.1 at this juncture. Also, we don't consider this as critical.
        Peter Ledbrook made changes -
        Fix Version/s 1.1-RC1 [ 14929 ]
        Priority Critical [ 2 ] Major [ 3 ]
        Fix Version/s 1.2 [ 14155 ]
        Graeme Rocher made changes -
        Fix Version/s 1.2-M1 [ 14155 ]
        Fix Version/s 1.2-M2 [ 15425 ]
        Graeme Rocher made changes -
        Fix Version/s 1.2-M3 [ 15547 ]
        Fix Version/s 1.2-M2 [ 15425 ]
        Graeme Rocher made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Graeme Rocher made changes -
        Fix Version/s 1.2-RC1 [ 15774 ]
        Fix Version/s 1.2-M3 [ 15547 ]
        Graeme Rocher made changes -
        Fix Version/s 1.2-RC1 [ 15959 ]
        Fix Version/s 1.2-M4 [ 15774 ]
        Hide
        Marcel Overdijk added a comment -

        There is an implementation available using new plugin:
        http://tinyurl.com/yz9ypsq
        http://tinyurl.com/yjrpnb2

        Show
        Marcel Overdijk added a comment - There is an implementation available using new plugin: http://tinyurl.com/yz9ypsq http://tinyurl.com/yjrpnb2
        Hide
        Graeme Rocher added a comment -

        There is no scope / time to resolve these remaining lower priority issues for 1.2 so moving to 1.3

        for 1.2 final only issues considered blocking will now be fixed

        Show
        Graeme Rocher added a comment - There is no scope / time to resolve these remaining lower priority issues for 1.2 so moving to 1.3 for 1.2 final only issues considered blocking will now be fixed
        Graeme Rocher made changes -
        Fix Version/s 1.2-RC1 [ 15959 ]
        Fix Version/s 1.3 [ 15400 ]
        Graeme Rocher made changes -
        Fix Version/s 1.3-RC1 [ 16274 ]
        Fix Version/s 1.3-M1 [ 15400 ]
        Hide
        Burt Beckwith added a comment -

        Closing since the referenced plugin implements the request.

        Show
        Burt Beckwith added a comment - Closing since the referenced plugin implements the request.
        Burt Beckwith made changes -
        Resolution Won't Fix [ 2 ]
        Assignee Graeme Rocher [ graemerocher ] Burt Beckwith [ burtbeckwith ]
        Fix Version/s 1.3-RC1 [ 16274 ]
        Status Open [ 1 ] Closed [ 6 ]
        Hide
        Marcel Overdijk added a comment -

        Hi Burt,

        I think it would be good considering adding the plugin's functionality to Grails core.
        Seems to me very basic stuff everyone Grails user could/should benefit off. See also number of voters.
        Another reason to merge this with core is that you never know if the plugin will be working/supported in future Grails version.

        Show
        Marcel Overdijk added a comment - Hi Burt, I think it would be good considering adding the plugin's functionality to Grails core. Seems to me very basic stuff everyone Grails user could/should benefit off. See also number of voters. Another reason to merge this with core is that you never know if the plugin will be working/supported in future Grails version.
        Hide
        Markus Mueller added a comment -

        + 1 for Marcels suggestion

        Show
        Markus Mueller added a comment - + 1 for Marcels suggestion
        Hide
        Marcel Overdijk added a comment -

        I would propose putting constraints in grails-app/contraints
        By default Grails doesn't even need to create this folder.
        Perhaps a create-custom-contraints script would be helpful, but not required at all.

        Show
        Marcel Overdijk added a comment - I would propose putting constraints in grails-app/contraints By default Grails doesn't even need to create this folder. Perhaps a create-custom-contraints script would be helpful, but not required at all.
        Burt Beckwith made changes -
        Status Closed [ 6 ] Reopened [ 4 ]
        Resolution Won't Fix [ 2 ]
        Contegix Support made changes -
        Project Import Thu Mar 24 21:22:24 CDT 2011 [ 1301019744151 ]
        Burt Beckwith made changes -
        Workflow jira [ 34243 ] Grails [ 41622 ]
        Burt Beckwith made changes -
        Workflow Grails [ 41622 ] Copy of Grails [ 49073 ]
        Burt Beckwith made changes -
        Workflow Copy of Grails [ 49073 ] Grails [ 56483 ]
        Burt Beckwith made changes -
        Workflow Grails [ 56483 ] Grails2 [ 64042 ]
        Burt Beckwith made changes -
        Workflow Grails2 [ 64042 ] jira [ 78194 ]
        Burt Beckwith made changes -
        Workflow jira [ 78194 ] Grails2 [ 80227 ]
        Peter Ledbrook made changes -
        Last Reviewed 01/Jan/10
        Peter Ledbrook made changes -
        Workflow Grails2 [ 80227 ] jira [ 88735 ]
        Peter Ledbrook made changes -
        Workflow jira [ 88735 ] Grails2 [ 96893 ]

          People

          • Assignee:
            Burt Beckwith
            Reporter:
            Marcel Overdijk
          • Votes:
            13 Vote for this issue
            Watchers:
            14 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development