Skip to content

Make install:openapi create the folders it needs #606

Closed

Description

@armanist

Summary

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

  1. added this to the 3.1.0 milestone on Oct 23, 2026
  2. added
    bugSomething isn't working
    openapiOpenAPI generation or hosting
    on Oct 23, 2026
  3. self-assigned this
    on Oct 23, 2026
  4. added a commit that references this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopenapiOpenAPI generation or hosting

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions