Skip to content

RFC: Split OCP into Consumable and Implementable to clarify intentions #15

@nickvergessen

Description

@nickvergessen

What?

  1. We have various interfaces where it is clear that apps are meant to implement them: - OCP\Notification\IApp
    • OCP\Notification\INotifier
  2. 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\IManager
    • OCP\Notification\INotification (should only be created with OCP\Notification\IManager::createNotification())

From my POV it would be good to distingiush them in a way, as they come with different implications.

  • OCP\Notification\IManager is 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 in OC\Notification\Manager. We can add return types and nothing explodes
  • For OCP\Notification\IApp it's the opposite, basically extending it will break all existing implementations. Similar to OCP\Dashboard\IWidget back then, new functionality needs to be brought in with a second interface IAPIWidgetV2, etc.

Image

  • 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 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions