-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
nextcloud/documentation
#13450Description
What?
- We have various interfaces where it is clear that apps are meant to implement them: -
OCP\Notification\IAppOCP\Notification\INotifier
- We have various interfaces where it is clear that apps can consume them, but it is not intended to get implemented by an app itself:
OCP\Notification\IManagerOCP\Notification\INotification(should only be created withOCP\Notification\IManager::createNotification())
From my POV it would be good to distingiush them in a way, as they come with different implications.
OCP\Notification\IManageris only meant to be consumsed, so we can add new methods and it could be considered non breaking as the only implementation is meant to be the one inOC\Notification\Manager. We can add return types and nothing explodes- For
OCP\Notification\IAppit's the opposite, basically extending it will break all existing implementations. Similar toOCP\Dashboard\IWidgetback then, new functionality needs to be brought in with a second interfaceIAPIWidgetV2, etc.
- My idea would be to introduce attributes which clarify the intention of the publishing, similar to Implement an OCP API for Context Chat server#52852 (comment)
Something along the lines:OCP\AppFramework\Consumable(since: MajorMinorServer, ?removal: MajorMinorServer)OCP\AppFramework\Implementable(since: MajorMinorServer, ?removal: MajorMinorServer)
Why?
- Allows faster progress on some APIs (
- Clarifies intention
- Should make it clear that things like Guests app RestrictionManager which replaces OCP\INavigationManager and OCP\Settings\IManager are not a good idea because both should be "Consumable"-only
Optional Part2:
To help with the last "Why" we could also allow apps to mark themselves as an exception to such a restriction, which means we "allow it when we are aware" and API can be extended when either adjusting the exception or clarifying a way with the maintainer of the exception how it can be "non-breaking" in the update experience.
Sample:
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyright…
*/
namespace OCP;
#[OCP\AppFramework\Consumable(since: '6.0.0')]
#[OCP\AppFramework\ExceptionalImplementation(app: 'guests', class: \OCA\Guests\FilteredNavigationManager::class)]
interface INavigationManager {provokateurin, blizzz, susnux, icewind1991, come-nc and 4 more
Metadata
Metadata
Assignees
Labels
No labels
