Skip to content

Single file swagger docs generation, #PG-4887#20

Merged
lachiebol merged 15 commits into
5.x-devfrom
PG-4887-single-swagger
Feb 16, 2026
Merged

Single file swagger docs generation, #PG-4887#20
lachiebol merged 15 commits into
5.x-devfrom
PG-4887-single-swagger

Conversation

@lachiebol
Copy link
Copy Markdown
Contributor

@lachiebol lachiebol commented Feb 10, 2026

Description

Have added new params to the openapidocs:generate-spec-file command.

Added 'all' option to --plugins param
Added --add-annotations param that does the intermediate step of generating annotations

For a single plugin:
ddev matomo:console openapidocs:generate-spec-file --plugin CrashAnalytics --not-dry-run --add-annotations

For multiple plugins:
ddev matomo:console openapidocs:generate-spec-file --plugin CrashAnalytics,AbTesting --not-dry-run --add-annotations

For all plugins:
ddev matomo:console openapidocs:generate-spec-file --plugin all --not-dry-run --add-annotations

Issue No

Steps to Replicate the Issue

Checklist

  • [✔] Tested locally or on demo2/demo3?
  • [NA] New test case added/updated?
  • [NA] Are all newly added texts included via translation?
  • [✔] Are text sanitized properly? (Eg use of v-text v/s v-html for vue)
  • [✔] Version bumped?
  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rule

@lachiebol lachiebol requested a review from a team February 11, 2026 01:18
@lachiebol lachiebol added the Needs Review For pull requests that need a code review. label Feb 11, 2026
@lachiebol lachiebol changed the title Single file swagger docs generation Single file swagger docs generation, #PG-4887 Feb 11, 2026
@lachiebol lachiebol marked this pull request as ready for review February 11, 2026 01:19
}

if (strtolower($plugin) == 'all') {
$plugins = require __DIR__ . '/../config/plugins.php';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lachiebol Is this something specific to ddev ? I don't see any such files.
I think below is the correct way to get all Plugins.

$pluginNames = PluginManager::getAllPluginsNames();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see below, you have added a list, can't we use above method and have a blockList ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the allowlist - safer that we have to manually add new plugins.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Assuming we keep this as an internal tool only)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lachiebol Is this something specific to ddev ? I don't see any such files. I think below is the correct way to get all Plugins.

$pluginNames = PluginManager::getAllPluginsNames();

The new list is only for plugins with an API.php file. I could go this route but I'll need to check how the existing commands handle plugins with no API

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with the current approach also 👍

Copy link
Copy Markdown
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lachiebol Getting below error when running

/console openapidocs:generate-spec-file --plugin=FormAnalytics --add-annotations
Image

}

if (strtolower($plugin) == 'all') {
$plugins = require __DIR__ . '/../config/plugins.php';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see below, you have added a list, can't we use above method and have a blockList ?

@james-hill-matomo
Copy link
Copy Markdown

@lachiebol Getting below error when running

/console openapidocs:generate-spec-file --plugin=FormAnalytics --add-annotations
Image

Codex picked up this one for me. I'm not sure why phpstan didn't find it either - maybe we need a higher level.

@lachiebol
Copy link
Copy Markdown
Contributor Author

@AltamashShaikh I've just added a case for where content-type isn't set. I'm curious what endpoint returned that for you, because it didn't happen for me.

I wonder if it's because it's failing the demo.matomo.cloud request, then falling back to our local matomo, which is different.

@AltamashShaikh
Copy link
Copy Markdown
Contributor

@AltamashShaikh I've just added a case for where content-type isn't set. I'm curious what endpoint returned that for you, because it didn't happen for me.

I wonder if it's because it's failing the demo.matomo.cloud request, then falling back to our local matomo, which is different.

@lachiebol You can view the error - https://demo.matomo.cloud/?module=API&method=FormAnalytics.getForms&idSite=1&format=Tsv&token_auth=anonymous&convertToUnicode=0&hideIdSubDatable=1

image

@AltamashShaikh
Copy link
Copy Markdown
Contributor

@lachiebol For local I am getting content-type:application/vnd.ms-excel
image

Comment thread CHANGELOG.md Outdated
Copy link
Copy Markdown
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@james-hill-matomo
Copy link
Copy Markdown

I got this when testing, but haven't had a chance to dig in:

Created Annotations for DBStats and wrote results to plugins/OpenApiDocs/tmp/annotations.
Created Annotations for Funnels and wrote results to plugins/OpenApiDocs/tmp/annotations.
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 146: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<Central America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	                ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 183: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</Central America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	          ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 271: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<North America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	              ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 341: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</North America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	        ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 391: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<South America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	              ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 436: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</South America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	        ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 146: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<Central America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	                ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 183: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</Central America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	          ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 271: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<North America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	              ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 341: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</North America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	        ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 391: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<South America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	              ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 436: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</South America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	        ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
ERROR     [2026-02-11 21:32:58] 243309  Uncaught exception: /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): String could not be parsed as XML
#0 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): SimpleXMLElement->__construct()
#1 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(944): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->convertExampleXmlToObject()
#2 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(846): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->getCachedExampleResponseFile()
#3 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1143): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->getExampleIfAvailable()
#4 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(257): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->determineResponses()
#5 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(140): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->buildAnnotationForMethod()
#6 /plugins/OpenApiDocs/Commands/GenerateSpecFile.php(102): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->generatePluginApiAnnotations()
#7 /core/Plugin/ConsoleCommand.php(143): Piwik\Plugins\OpenApiDocs\Commands\GenerateSpecFile->doExecute()
#8 /vendor/symfony/console/Command/Command.php(298): Piwik\Plugin\ConsoleCommand->execute()
#9 /core/Plugin/ConsoleCommand.php(158): Symfony\Component\Console\Command\Command->run()
#10 /vendor/symfony/console/Application.php(1040): Piwik\Plugin\ConsoleCommand->run()
#11 /vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#12 /core/Console.php(113): Symfony\Component\Console\Application->doRun()
#13 [internal function]: Piwik\Console->originDoRun()
#14 /core/Console.php(156): call_user_func()
#15 /core/Access.php(672): Piwik\Console->{closure:Piwik\Console::doRunImpl():154}()
#16 /core/Console.php(154): Piwik\Access::doAsSuperUser()
#17 /core/Console.php(92): Piwik\Console->doRunImpl()
#18 /vendor/symfony/console/Application.php(171): Piwik\Console->doRun()
#19 /console(32): Symfony\Component\Console\Application->run()
#20 {main} [Query: , CLI mode: 1]

In AnnotationGenerator.php line 1022:
                                     
  String could not be parsed as XML  
                                     

openapidocs:generate-spec-file [-p|--plugin PLUGIN] [-f|--format FORMAT] [--api-version API-VERSION] [--not-dry-run] [--add-annotations]

@lachiebol
Copy link
Copy Markdown
Contributor Author

lachiebol commented Feb 12, 2026

I got this when testing, but haven't had a chance to dig in:

Created Annotations for DBStats and wrote results to plugins/OpenApiDocs/tmp/annotations.
Created Annotations for Funnels and wrote results to plugins/OpenApiDocs/tmp/annotations.
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 146: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<Central America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	                ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 183: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</Central America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	          ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 271: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<North America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	              ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 341: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</North America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	        ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 391: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<South America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	              ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 436: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</South America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	        ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 146: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<Central America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	                ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:57] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 183: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</Central America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	          ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 271: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<North America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	              ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 341: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</North America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	        ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 391: parser error : Specification mandates value for attribute America - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	<South America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	              ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): Entity: line 436: parser error : expected '>' - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	</South America> - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING   [2026-02-11 21:32:58] 243309  /var/www/html/plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): Warning - SimpleXMLElement::__construct(): 	        ^ - Matomo 5.7.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
ERROR     [2026-02-11 21:32:58] 243309  Uncaught exception: /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): String could not be parsed as XML
#0 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1022): SimpleXMLElement->__construct()
#1 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(944): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->convertExampleXmlToObject()
#2 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(846): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->getCachedExampleResponseFile()
#3 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(1143): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->getExampleIfAvailable()
#4 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(257): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->determineResponses()
#5 /plugins/OpenApiDocs/Annotations/AnnotationGenerator.php(140): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->buildAnnotationForMethod()
#6 /plugins/OpenApiDocs/Commands/GenerateSpecFile.php(102): Piwik\Plugins\OpenApiDocs\Annotations\AnnotationGenerator->generatePluginApiAnnotations()
#7 /core/Plugin/ConsoleCommand.php(143): Piwik\Plugins\OpenApiDocs\Commands\GenerateSpecFile->doExecute()
#8 /vendor/symfony/console/Command/Command.php(298): Piwik\Plugin\ConsoleCommand->execute()
#9 /core/Plugin/ConsoleCommand.php(158): Symfony\Component\Console\Command\Command->run()
#10 /vendor/symfony/console/Application.php(1040): Piwik\Plugin\ConsoleCommand->run()
#11 /vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#12 /core/Console.php(113): Symfony\Component\Console\Application->doRun()
#13 [internal function]: Piwik\Console->originDoRun()
#14 /core/Console.php(156): call_user_func()
#15 /core/Access.php(672): Piwik\Console->{closure:Piwik\Console::doRunImpl():154}()
#16 /core/Console.php(154): Piwik\Access::doAsSuperUser()
#17 /core/Console.php(92): Piwik\Console->doRunImpl()
#18 /vendor/symfony/console/Application.php(171): Piwik\Console->doRun()
#19 /console(32): Symfony\Component\Console\Application->run()
#20 {main} [Query: , CLI mode: 1]

In AnnotationGenerator.php line 1022:
                                     
  String could not be parsed as XML  
                                     

openapidocs:generate-spec-file [-p|--plugin PLUGIN] [-f|--format FORMAT] [--api-version API-VERSION] [--not-dry-run] [--add-annotations]

@james-hill-matomo It looks like you have a cached response from demo that has invalid XML (spaces in <South America>). I'll add a check when it grabs from cache as well.

@lachiebol
Copy link
Copy Markdown
Contributor Author

@james-hill-matomo That error shouldn't show now. We just skip the invalid XML now, it would be nice to go fix that endpoint so it was proper XML

Co-authored-by: Altamash Shaikh <altu9594@gmail.com>
@lachiebol lachiebol merged commit 6f37444 into 5.x-dev Feb 16, 2026
7 checks passed
@lachiebol lachiebol deleted the PG-4887-single-swagger branch February 16, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review For pull requests that need a code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants