sbglasius commented on code in PR #15526:
URL: https://github.com/apache/grails-core/pull/15526#discussion_r2981822790


##########
grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingEvaluator.java:
##########
@@ -418,6 +418,69 @@ public void group(String uri, Closure<?> mappingsClosure) {
             }
         }
 
+        /**
+         * Define a group with default mapping parameters that are inherited 
by child mappings.
+         * Child mappings can override any default by specifying the parameter 
explicitly.
+         *
+         * <p>Example usage:
+         * <pre>
+         * group "/api", namespace: 'api', controller: 'resource', {
+         *     "/list"(action: 'list')    // inherits namespace and controller
+         *     "/show"(action: 'show')    // inherits namespace and controller
+         * }
+         * </pre>
+         *
+         * @param defaults Map of default parameters (controller, action, 
namespace, plugin, view)

Review Comment:
   Good point.



##########
grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingEvaluator.java:
##########
@@ -1282,5 +1351,13 @@ public void group(String uri, Closure<?> mappings) {
             }
             super.group(uri, mappings);
         }
+
+        @Override
+        public void group(Map<String, Object> defaults, String uri, Closure<?> 
mappings) {
+            if (parentResource != null) {
+                uri = parentResource.uri.concat(uri);
+            }
+            super.group(defaults, uri, mappings);
+        }

Review Comment:
   @copilot Having a `Map<String, Object> default` first as arguments makes it 
a Named argument collector.



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