[MGNLRESTUI-16] A wrapper for YAML expressions in RestClientResultSupplierDefinition Created: 16/Jan/20 Updated: 28/Jun/22 |
|
| Status: | Open |
| Project: | Magnolia REST Client UI |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Martin Drápela | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Epic Link: | RestClient Maintenance | ||||||||
| Description |
|
Some APIs (Confluence's for instance) don't return a full URL link in the response, just its fragment such as the path, making it difficult to use it as a functioning link in the Find Bar results. See the webui property in the following response: {
"results":[
{
"id":"173020719",
"type":"page",
"status":"current",
"title":"Part II - Fine-tuning a basic content app",
"restrictions":{
},
"_links":{
"webui":"/display/DOCS61/Part+II+-+Fine-tuning+a+basic+content+app",
"tinyui":"/x/LxZQCg",
"self":"https://wiki.magnolia-cms.com/rest/api/content/173020719"
},
"_expandable":{
"container":"",
"metadata":"",
"extensions":"",
"operations":"",
"children":"",
"history":"/rest/api/content/173020719/history",
"ancestors":"",
"body":"",
"version":"",
"descendants":"",
"space":"/rest/api/space/DOCS61"
}
}
],
"start":0,
"limit":25,
"size":1,
"_links":{
"self":"https://wiki.magnolia-cms.com/rest/api/content/search?cql=space=DOCS61%20AND%20text~libib",
"base":"https://wiki.magnolia-cms.com",
"context":""
}
}
A wrapper functionality such as the templateUrl shown below would allow the user to bypass this issue. class: info.magnolia.rest.ui.periscope.RestClientResultSupplierDefinition
restClient: magnolia-docs
restCall: searchMgnlDocs61
searchResultExpression:
title: $..title
url: $.._links.webui
templateUrl: 'https://documentation.magnolia-cms.com{url}'
The wrapper functionality could be implemented even for the title property and hence templateTitle so that I could customize even the result title shown in the Find Bar results area, that is to see, e.g. "Part II - Fine-tuning a basic content app (DOCS 6.1)" provided by the REST response. A more universal approach - not requiring an extra property for each expression - might look like this: class: info.magnolia.rest.ui.periscope.RestClientResultSupplierDefinition
restClient: magnolia-docs
restCall: searchMgnlDocs61
searchResultExpression:
title: {$..title}(DOCS 6.1)
url: https://documentation.magnolia-cms.com{$.._links.webui}
|