OpenAPI generation is broken
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.
True. But it never did work. 😉
This is still a to do.
BTW: Any support is welcome, since I did not get in touch with it deeper.
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 :)
This issue is marked as stale, because it had no activity in the last 30 days. It will be closed in 5 days.
The openAPIExtractor does not like blanks
@psalm-type PollsPollPermissions = array { --> @psalm-type PollsPollPermissions = array{
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.
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.
Try --verbose and post the output, it should help debugging the problem.
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.
This issue is marked as stale, because it had no activity in the last 30 days. It will be closed in 5 days.