JSONAPI_Rendering - grails/grails-views GitHub Wiki
#Rendering the JSON:
##Ability to enable/disable the JSON API Object
##Configurable:
- Sensible defaults matching the spec
- per-app config mechanism driven via standard grails config
- per-view dynamic configuration like:
json jsonapi.render([data: widget, exposeJsonApiObject: true])
##Error Handling: json jsonapi.render(widget) http://jsonapi.org/format/#errors
-
Automatic error handling with Validation Errors
json jsonapi.render(widget)
-
Manual Error handling:
model {
Errors errors
}
json jsonapi.render([errors: errors])
http://jsonapi.org/format/#document-compound-documents Something similar to:
model {
Widget widget
Producer widgetProducer
List<Market> markets
}
json jsonapi.render(widget, [included: [widgetProducer, markets]])