Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
28 Mar 2024

Pull Request for Issue #37305 .

Summary of Changes

When creating a new JSONApiView object, but not handing over the optional parameter 'contentType', the following line with the JoomlaSerializer throws an error.

Testing Instructions

Codereview

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar Hackwar Hackwar - open - 28 Mar 2024
avatar Hackwar Hackwar - change - 28 Mar 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Mar 2024
Category Libraries
avatar Quy Quy - test_item - 29 Mar 2024 - Tested successfully
avatar Quy
Quy - comment - 29 Mar 2024

I have tested this item ✅ successfully on 9c3c54e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43179.

avatar wilsonge
wilsonge - comment - 29 Mar 2024

The intention here was type is a required parameter. Either via injecting through content type or setting it directly in the class depending on the use case. We might be better off throwing a legit 500 to symbolize that though, the serializer is required for both displayList and displayItem - so don't think this is the fix.

avatar HLeithner
HLeithner - comment - 31 Jul 2024

In this case we should do it the same as all other object we need.
So we need a SerializerAwareInterface requres a setSerializer function and SerializerAwareTrait this implements with a private variable and a getter function.
Similar to CurrentUserInterface

avatar HLeithner
HLeithner - comment - 15 Nov 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 15 Nov 2024
Title
[4.4] JSONApiView: Ensure type is set
[5.2] JSONApiView: Ensure type is set
avatar HLeithner HLeithner - edited - 15 Nov 2024
avatar HLeithner
HLeithner - comment - 15 Apr 2025

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 15 Apr 2025
Title
[5.2] JSONApiView: Ensure type is set
[5.3] JSONApiView: Ensure type is set
avatar HLeithner HLeithner - edited - 15 Apr 2025
avatar Hackwar
Hackwar - comment - 19 Apr 2025

So, what should we do with this? @HLeithner says a new trait and interface, @wilsonge rather wants to throw an exception and is against the other proposal. I think having an interface and trait for this one thing seems overkill. I'd like to move forward here and solve this or close the PR. Any opinions?

avatar wilsonge
wilsonge - comment - 20 Apr 2025

Definitely agree trait is overkill. I'd rather my solution and bail. But if not aren't we just getting an error when we call display? Because the serializer is kind of required no?

Add a Comment

Login with GitHub to post a comment