codeconsole opened a new issue, #14769:
URL: https://github.com/apache/grails-core/issues/14769
### Feature description
Currently Grails controllers render json with no model. This is extremely
limiting and contrary to how other views work. For instance, def index()
provides `"${entityName.uncapitalize()Count}"` to index.gsp, but index.json
just returns a json list with no count.
Meta data is crucial for being able to properly paginate through large
amount of results or even providing context.
Proper pagination should use cursors instead of offsets and using the
default rendering strategy provides no mechanism for providing this meta data.
The default should be changed to a structure that provides data and meta
data.
A possibility is:
```json
{
"data": [ /* the list */ ],
"meta": { /* the model */ },
}
```
For example:
```json
{
"data": [ { "name": "Bob", "id": 1 }, ... ],
"meta": { "count": 100, "cursor": "aSdFa123" }
}
```
--
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]