apache / apache/grails-core

Make using absolute vs. relative links in JSON API pagination links configurable.

Open
#14,304 0 comments 0 reactions 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

Is there a way the absolute parameter can be made configurable (in application.yml) when rendering the paging links? Currently the only way to do this is through using a custom baseTemplateClass and overriding the jsonapi object.
```
./DefaultJsonViewHelper.groovy: links << new Link("first", link(resource: object, method: HttpMethod.GET, absolute: true, params: firstParams))
./DefaultJsonViewHelper.groovy: links << new Link("prev", link(resource: object, method: HttpMethod.GET, absolute: true, params: prevParams))
./DefaultJsonViewHelper.groovy: links << new Link("next", link(resource: object, method: HttpMethod.GET, absolute: true, params: nextParams))
./DefaultJsonViewHelper.groovy: links << new Link("last", link(resource: object, method: HttpMethod.GET, absolute: true, params: lastParams))
```

Contributor guide

Open the contributing guide

Research direction

Start with DefaultJsonViewHelper.groovy and the application.yml configuration path described in the issue. Trace how the pagination links are rendered, then verify that the absolute-versus-relative choice can be configured for the first, previous, next, and last links.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.