Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource collection does not work as expected if the resource is within group #10844

Open
ilmoralito opened this issue Oct 30, 2017 · 1 comment

Comments

@ilmoralito
Copy link

Steps to Reproduce

  1. Clone demo app
  2. Run url-mapping-report command

Expected Behaviour

The following url mapping add a URI directly below a resource using collection

group '/api', {
    '/employees'(resources: 'employee') {
        collection {
            '/search'(controller: 'employee', action: 'search', method: 'GET')
        }
    }
}

Should generate the following result regarding the search action

Controller: employee
 |   GET    | /api/employees/create                             | Action: create           |
 |   GET    | /api/employees/search                             | Action: search           |
 |   GET    | /api/employees/${id}/edit                         | Action: edit             |
 |   POST   | /api/employees                                    | Action: save             |
 |   GET    | /api/employees                                    | Action: index            |
 |  DELETE  | /api/employees/${id}                              | Action: delete           |
 |  PATCH   | /api/employees/${id}                              | Action: patch            |
 |   PUT    | /api/employees/${id}                              | Action: update           |
 |   GET    | /api/employees/${id}                              | Action: show             |

Actual Behaviour

Controller: employee
 |   GET    | /api/employees/create                             | Action: create           |
 |   GET    | /api/employees/${id}/edit                         | Action: edit             |
 |   GET    | /api/employees/${employeeId}/search               | Action: search           |
 |   POST   | /api/employees                                    | Action: save             |
 |   GET    | /api/employees                                    | Action: index            |
 |  DELETE  | /api/employees/${id}                              | Action: delete           |
 |  PATCH   | /api/employees/${id}                              | Action: patch            |
 |   PUT    | /api/employees/${id}                              | Action: update           |
 |   GET    | /api/employees/${id}                              | Action: show             |

If I avoid using group the result of using collection within resource is the expected

'/api/employees'(resources: 'employee') {
    collection {
        '/search'(controller: 'employee', action: 'search', method: 'GET')
    }
}

For the search action I get the following result

/api/employees/search

Environment Information

  • Operating System: ubuntu 16.04
  • Grails Version: Using grails version 3.3.1
  • JDK Version: Using java version 8u144-zulu

Example Application

https://github.com/ilmoralito/url-mapping-report-demo

@olliefreeman
Copy link

I am also experiencing this, with grails 3.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants