nextcloud / nextcloud/openapi-extractor

Extractor doesn't consider inherited functions to implement routes

Open
#28 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
11
Forks
4
Avg merge
10h 18m
Merged PRs (30d)
8

Description

If a route is configured that is implemented by a controller's parent class, an error is thrown saying 'Missing controller method'.

In my case, the method in question is the method authenticate from OCP\AppFramework\AuthPublicShareController which can't be overwritten by my controller because it is final.

As a workaround, I'll try to a proxy function that forwards its parameters to parent::authenticate, but ideally that should not be necessary.

My relevant routes:

<?php
declare(strict_types=1);

return [
	'routes' => [
		// ....
		['name' => 'SecretShare#authenticate', 'root' => '/secret',
			'url' => '/show/{token}/authenticate/{redirect}', 'verb' => 'POST'],
	],
	'ocs' => [
                // ....
	]
];

Excerpt from my controller class:

<?php
declare(strict_types=1);

namespace OCA\Secrets\Controller;

use OCP\AppFramework\AuthPublicShareController;

class SecretShareController extends AuthPublicShareController {
	// ...
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the route configuration for SecretShare#authenticate and the SecretShareController extending OCP\AppFramework\AuthPublicShareController. Trace the extractor's controller-method lookup to determine why inherited methods are rejected, then verify that the route is accepted without the missing-method error while preserving handling of final parent methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.