polls icon indicating copy to clipboard operation
polls copied to clipboard

OpenAPI generation is broken

Open provokateurin opened this issue 8 months ago • 10 comments

Annoncement

$ composer exec generate-spec
Info: app: Extracting OpenAPI spec for polls 8.0.0-beta7
PHP Fatal error:  Uncaught Error: Response definitions: PollsPollPermissions: Unable to resolve OpenAPI type:
\PHPStan\PhpDocParser\Ast\Type\InvalidTypeNode::__set_state(array(
   'exceptionArgs' => 
  array (
    0 => '{',
    1 => 33,
    2 => 48,
    3 => 28,
    4 => NULL,
    5 => 2,
  ),
   'attributes' => 
  array (
    'startLine' => 2,
    'endLine' => 16,
    'startIndex' => 8,
    'endIndex' => 103,
  ),
))

Something in the code in https://github.com/nextcloud/polls/blob/main/lib/ResponseDefinitions.php is invalid, this is not a bug in openapi-extractor.

provokateurin avatar May 13 '25 10:05 provokateurin

True. But it never did work. 😉

This is still a to do.

dartcafe avatar May 14 '25 18:05 dartcafe

BTW: Any support is welcome, since I did not get in touch with it deeper.

dartcafe avatar May 14 '25 18:05 dartcafe

I already maintain most of the other OpenAPI stuff in Nextcloud so I don't have much time, but if you have specific questions you can always ask me :)

provokateurin avatar May 14 '25 20:05 provokateurin

This issue is marked as stale, because it had no activity in the last 30 days. It will be closed in 5 days.

github-actions[bot] avatar Jun 26 '25 03:06 github-actions[bot]

The openAPIExtractor does not like blanks

@psalm-type PollsPollPermissions = array { --> @psalm-type PollsPollPermissions = array{

dartcafe avatar Jun 27 '25 21:06 dartcafe

Yeah because this is invalid syntax and https://github.com/phpstan/phpdoc-parser doesn't like it... You can't add a random space there.

provokateurin avatar Jun 28 '25 07:06 provokateurin

When I run generate-spec I get a couple of warnings and some fatal error, I am not sure how to handle them:

warnings

A couple of: Warning: Admin#index: You are extending a custom controller class. Make sure that it ends with "OCSController" if it extends "OCSController" itself.

Not sure how I can remove them, because these endpoints are no OCS-Endpoints

fatal

PHP Fatal error: Uncaught Error: app: No routes or capabilities defined thrown in nextcloud/polls/vendor-bin/openapi-extractor/vendor/nextcloud/openapi-extractor/src/Logger.php on line 52

I don't use Capabilities and the routes should be set.

dartcafe avatar Jun 28 '25 18:06 dartcafe

Try --verbose and post the output, it should help debugging the problem.

provokateurin avatar Jun 28 '25 19:06 provokateurin

Start says Debug: Capabilities: No capabilities were loaded which seems to be correct for me.

At least the warnings seem to be obsolete:

Warning: Admin#index: You are extending a custom controller class. Make sure that it ends with "OCSController" if it extends "OCSController" itself.
Debug: Admin#index: Route ignored because of OpenAPI attribute

But I get no additional info about the fatal error.

dartcafe avatar Jun 28 '25 19:06 dartcafe

This issue is marked as stale, because it had no activity in the last 30 days. It will be closed in 5 days.

github-actions[bot] avatar Jul 29 '25 03:07 github-actions[bot]