[MGNLREST-287] Unable To Get Secondary Language From Rest Response When Primary Language Is Blank Created: 12/Nov/20  Updated: 19/May/21  Resolved: 18/May/21

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: 2.2.6
Fix Version/s: 2.2.7

Type: Bug Priority: Neutral
Reporter: Julian Nodarse Assignee: Lam Nguyen Bao
Resolution: Fixed Votes: 0
Labels: VN-Analysis, VN-Maintenance, VN-Testing, headless-team-support
Remaining Estimate: Not Specified
Time Spent: 3.25d
Original Estimate: Not Specified

Issue Links:
causality
relation
is related to MGNLREST-286 Multivalue Composite Fields Using i18... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Epic Link: Support
Sprint: HL & LD 28
Story Points: 3

 Description   

When you create some i18n content and try to retrieve the data with rest calls containing language query parameters, the query will not return the appropriate language when the content using the fallbackLocale is left blank. This happens when the parameter is anything but the fallbackLocale's. 

Steps to Reproduce
1 - Create a simple endpoint to retrieve page nodes and all its accompanying information (you can use the endpoint I've attached).
2 - Enable i18n on your site and include a fallbackLocale
3 - Create a page (or use an existing page) and add some content for the language that is not the fallbackLocale.
4 - Leave the content using the fallbackLocale empty
5 - Try to retrieve the data you've made with rest calls making sure to specify a language in the query (See Additional Notes for examples)

Actual Result
When requesting a language other than the fallbackLocale, the response does not include the resulting property with its requested language although the property has it set.

Expected Result
The response returns the property requested with its specified language, even if the fallbackLocale version of the property is not set.

Additional Notes / Examples
Tested on 6.2.3 , 6.1.6 and 5.7.8.
This can be reproduced on the demo. You can try by altering the title for the About app in different languages. Leave the "en" title blank and the "de" title with something. Then add an endpoint (you can add it within the Resources App in an already existing module such as within the path : /tours/restEndpoints/delivery)
and try to invoke the rest call and specify a language. Here are some example calls :

https://demoauthor.magnolia-cms.com/.rest/delivery/{your_endpoint}/travel/about?lang=all
https://demoauthor.magnolia-cms.com/.rest/delivery/{your_endpoint}/travel/about?lang=en
https://demoauthor.magnolia-cms.com/.rest/delivery/{your_endpoint}/travel/about?lang=de

Let's say you set fallbackLocale to "en", then you will see that when you leave the content that uses "en" blank:
"all" will return only de which is correct.
"en" will not return anything which is also correct
"de" will not return anything which is wrong

Workarounds

  • Use "all" in your query then parse the response using some code.
  • Do not leave the fallbackLocale's content blank.

Generated at Mon Feb 12 06:58:26 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.