grails-views icon indicating copy to clipboard operation
grails-views copied to clipboard

Grails json-views: Make templates easier to debug and use

Open rmorrise opened this issue 6 years ago • 1 comments

I find troubleshooting json-views extremely difficult. Here are some (hopefully small) concrete changes that would really improve the experience:

  • Add TRACE- or DEBUG-level logging to the template resolver logic. The log output should show which paths were tested and whether or not a template was found.
  • When invoking tmpl."/templateType/_templateType", the template resolver is converting it to a double-underscore: /templateType/__templateType. The framework should not do this.
  • Make sure all code paths attempt to use the template resolver. It seems like it doesn't always try to resolve templates for non-GORM objects.
  • I don't know why, but it keeps trying to resolve templates for java.lang.Long. It doesn't seem to do this for other built-in classes (like strings). This doesn't really hurt anything, but it makes debugging take longer.
  • Document the behavior for absolute VS relative template URIs
  • Document an example of rendering an array of items using parent and child templates (master-detail)

rmorrise avatar May 17 '19 19:05 rmorrise

  • OK
  • That is documented http://views.grails.org/latest/#_templates
  • OK
  • Sounds like a bug
  • That is documented http://views.grails.org/latest/#_templates. Perhaps it could be made more clear
  • Pretty sure that is documented as well. You'd have to provide an example of what you mean.

A PR would be welcome for any of these improvements

jameskleeh avatar May 17 '19 19:05 jameskleeh