You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make install:openapi create the folders it needs #606
install:openapi fails when the module has no resources folder or the project has no public/assets/OpenApiUi folder. Part of the PHP 8.1 update (#595), found while smoke-testing the API templates (#597).
Why
A module generated with module:generate -t DefaultApi has no resources folder. install:openapi then fails with mkdir(): No such file or directory, because it creates resources/openapi with LocalFileSystemAdapter::makeDirectory(), which calls mkdir() without the recursive flag. The DemoApi template ships a resources folder, so it works.
When public/assets/OpenApiUi does not exist, copyResources() fails with copy(public/assets/OpenApiUi\index.css): Failed to open stream, because it copies into the folder without creating it.
Proposed change
Create modules/<Name>/resources/openapi including its missing parents.
Create public/assets/OpenApiUi before copying the Swagger UI files into it.
Extend OpenApiCommandTest with one case for each missing folder.
Out of scope
Making makeDirectory() recursive for every caller.
Breaking changes
None.
Acceptance criteria
php qt install:openapi <module> succeeds for a module generated from the DefaultApi template
php qt install:openapi <module> succeeds when public/assets/OpenApiUi does not exist
composer test, composer cs:check, composer phpstan and composer rector:check pass
Activity
[#606] Create the folders install:openapi needs