Skip to content

Conversation

@SebastianKrupinski
Copy link
Contributor

@SebastianKrupinski SebastianKrupinski commented Oct 23, 2025

Summary

Checklist

@SebastianKrupinski SebastianKrupinski self-assigned this Oct 23, 2025
@SebastianKrupinski SebastianKrupinski added the 2. developing Work in progress label Oct 23, 2025
@SebastianKrupinski SebastianKrupinski force-pushed the feat/task-processing-for-email branch 2 times, most recently from 2e53963 to fa0c16e Compare November 10, 2025 12:34
@SebastianKrupinski SebastianKrupinski added this to the Nextcloud 33 milestone Nov 10, 2025
@SebastianKrupinski SebastianKrupinski added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Nov 10, 2025
@SebastianKrupinski SebastianKrupinski marked this pull request as ready for review November 10, 2025 12:37
@SebastianKrupinski SebastianKrupinski requested a review from a team as a code owner November 10, 2025 12:37
@SebastianKrupinski SebastianKrupinski requested review from Altahrim, artonge, come-nc, icewind1991 and leftybournes and removed request for a team November 10, 2025 12:37
*
* @param array array representation of this object
*/
public function jsonDeserialize(array|string $data): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer a static function returning a new instance like https://github.com/nextcloud/mail/blob/1c24b8cf306f56ce5cbe2a86fb811a395ddd53fd/lib/Address.php#L32-L43 instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! yes, good point!

Done

*/
interface JsonDeserializable {

public function jsonDeserialize(array|string $data): static;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer a static method because the dynamic method needs object instantiation first. That is not an option for objects with required constructor arguments.

Copy link
Contributor Author

@SebastianKrupinski SebastianKrupinski Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that on purpose, to preserve DI functionality. If we use the static object building pattern, we can't inject any service a object might need like L10N.

So what would you prefer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static method. Data objects should not use DI. DI is for services.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit unsure about static vs just using self but looks good otherwise 👍 :shipit:

@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Nov 25, 2025
@ChristophWurst
Copy link
Member

Documentation (manuals or wiki) has been updated or is not required

This change adds a new public API: the json deserialize interface. This means the developer documentation has to be extended.

@SebastianKrupinski SebastianKrupinski force-pushed the feat/task-processing-for-email branch 2 times, most recently from b9116e9 to 17648f0 Compare November 25, 2025 16:10
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@SebastianKrupinski SebastianKrupinski force-pushed the feat/task-processing-for-email branch from 17648f0 to f158d33 Compare November 27, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews pending documentation This pull request needs an associated documentation update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants