7.1.x Scaffolding Display Constraint Expansion#15266
7.1.x Scaffolding Display Constraint Expansion#15266codeconsole merged 12 commits intoapache:7.1.xfrom
Conversation
|
Looks useful! I find the |
There already is an editable constraint that controls whether a field is read-only in forms. "input" and "output" directly correspond to the view types:
Using I chose NONE because it is similar to display: 'none' is a css rule which is pretty common.
|
| * @return The display type controlling where this property is shown in scaffolded views | ||
| * @since 7.1 | ||
| */ | ||
| DisplayType getDisplayType() |
There was a problem hiding this comment.
So to date, everything has been an optional / minor breaking change. But changing constrained means that this will be a breaking change, no? @matrei what are your thoughts on this?
There was a problem hiding this comment.
@jdaugherty is adding a constraint breaking?
There was a problem hiding this comment.
Adding the constraint isn't, but changing the base interface that's applied to every object I assume would be breaking. We need to test this.
There was a problem hiding this comment.
@sbglasius is going to test this change with his side project to ensure it's backwards compatible.
There was a problem hiding this comment.
Yes, we should test this, we don't want to have to recompile/re-release plugins for 7.1 compatibility.
There was a problem hiding this comment.
Turns out, I'm implementing grails.gorm.validation.Constraint and not grails.gorm.validation.Constrained
I think it would be best, if @codeconsole makes a Constrained implementation with 7.0.4 and run it with 7.1.0-SNAPSHOT
Or direct me on how to do so.
There was a problem hiding this comment.
@sbglasius I think the real concern is this being a breaking change across domain objects for 7.x.
If you have your plugin with a domain class on 7.0.4, and you have your application on 7.1, what happens when you call findConstrainedProperties(Holders.grailsApplication.mappingContext.getPersistentEntity(MyDomain.class)) in your application? If it works, this isnt' a breaking change, if it doesn't, it is.
@codeconsole Yes, that's a valid point. I'm fine with the naming as it is. |
|
My only remaining concern is if this is a breaking change. If it is, we need to agree as a group that this is ok for a minor release since it will force all plugins to be recompiled again. |
|
@jdaugherty what is the concern that this is breaking? This PR is for 7.1.x apps. Why would you run 7.1.x scaffolding plugin on 7.0.x? This isn't an AST transformation. |
|
@codeconsole This scenario: create a 7.0.x plugin with a domain, don't update the 7.0.x plugin, have your 7.1.x app pull in that plugin (doesn't rebuild). This PR has changed an interface that is injected via an AST so it may break. I haven't had time to put together a multiproject build to test this unfortunately. It's on my list to do it after the holidays. Ultimately, we're trying to avoid rebuilding every grails plugin in minor releases unless there's a good reason. |
@jdaugherty I don't think that is how AST transformations work. AST transformation that add an interface don't also inject the implementation of that interface. The implementation is external and part of the grails-datamapping-validation jar. Therefore, If you have a 7.0.x plugin with a domain and grails is upgraded to 7.1.x, it is going to use the 7.1.x dependencies and there respective implementations. |
|
@codeconsole Thanks, now the |




Modify display constraint so that
For instance, let's say you have
String passwordyou would wantdisplay: INPUT_ONLYFor
Date dateCreated, perhaps ideal configuration isdisplay: OUTPUT_ONLYThis is backwards compatible with
display: boolean