jdaugherty commented on code in PR #15266:
URL: https://github.com/apache/grails-core/pull/15266#discussion_r2578859637


##########
grails-datamapping-validation/src/main/groovy/grails/gorm/validation/Constrained.groovy:
##########
@@ -88,9 +88,16 @@ interface Constrained {
      */
     boolean isUrl()
     /**
-     * @return Whether the value should be displayed
+     * @return Whether the value should be displayed (for backwards 
compatibility)
+     * @deprecated Use {@link #getDisplayType()} instead for more granular 
control
      */
     boolean isDisplay()
+
+    /**
+     * @return The display type controlling where this property is shown in 
scaffolded views
+     * @since 7.1
+     */
+    DisplayType getDisplayType()

Review 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? 



##########
grails-fields/src/main/groovy/org/grails/scaffolding/model/DomainModelServiceImpl.groovy:
##########
@@ -88,16 +92,25 @@ class DomainModelServiceImpl implements DomainModelService {
         }
 
         properties.removeAll {
-            if (it.name in blacklist) {
-                return true
-            }
             Constrained constrained = it.constrained
-            if (constrained && !constrained.display) {
+            DisplayType displayType = constrained?.displayType
+
+            if (displayType == DisplayType.ALL || displayType == 
DisplayType.OUTPUT_ONLY) {

Review Comment:
   The property is being used by fields, but documented as a scaffolding 
constraint? 



##########
grails-datamapping-validation/src/main/groovy/grails/gorm/validation/DisplayType.groovy:
##########
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package grails.gorm.validation
+
+/**
+ * Enum representing the display behavior for a constrained property in 
scaffolded views.

Review Comment:
   The library being changed here doesn't have anything to do with scaffolding. 
 Wouldn't it be better to introduce a constraint specific to scaffolding?  
   
   The more I think about this this seems very view-centric and it's being 
added to the domain layer.  This just feels wrong from a separation perspective.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to