apache / apache/grails-core

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

Open
#14,311 1 comment 1 reaction 0 assignees View on GitHub
relates-to: grails-views
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

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)

Contributor guide

Open the contributing guide

Research direction

Start by locating the json-views template resolver and its existing documentation, then trace each listed resolution case, including non-GORM objects, java.lang.Long, and the double-underscore conversion. Done means the requested logging and resolution behavior are addressed, and the absolute/relative URI and master-detail examples are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.