Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller namespace issue for modules in urlPrefixes #39

Open
SOHELAHMED7 opened this issue Sep 2, 2024 · 0 comments · May be fixed by #38
Open

Controller namespace issue for modules in urlPrefixes #39

SOHELAHMED7 opened this issue Sep 2, 2024 · 0 comments · May be fixed by #38
Assignees

Comments

@SOHELAHMED7
Copy link
Member

SOHELAHMED7 commented Sep 2, 2024

Controller namespace for modules in urlPrefixes does not work properly.

If controllers have same name/id in different modules, we get error.

Expected: It should not throw error and should generate the code successfully.

Given the failing test 73aa9b3

we get error:

phpunit --filter '/IssueFixTest::testControllerNamespaceIssueForModulesInUrlPrefixes$/'
PHPUnit 8.5.38 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 79 ms, Memory: 12.00 MB

There was 1 error:

1) tests\unit\IssueFixTest::testControllerNamespaceIssueForModulesInUrlPrefixes
Laminas\Code\Generator\Exception\InvalidArgumentException: A method by name actionList already exists in this class.

/app/vendor/laminas/laminas-code/src/Generator/ClassGenerator.php:866
/app/vendor/laminas/laminas-code/src/Generator/ClassGenerator.php:852
/app/src/lib/generators/ControllersGenerator.php:136
/app/src/lib/generators/ControllersGenerator.php:83
/app/src/generator/ApiGenerator.php:477
/app/tests/DbTestCase.php:62
/app/tests/unit/IssueFixTest.php:368
phpvfscomposer:///app/vendor/phpunit/phpunit/phpunit:97

ERRORS!
Tests: 1, Assertions: 1, Errors: 1.


Related to #14

@SOHELAHMED7 SOHELAHMED7 self-assigned this Sep 2, 2024
SOHELAHMED7 added a commit that referenced this issue Sep 6, 2024
If params is not required then we get validation error:

```
Array
(
    [openApiPath] => Array
        (
            [0] => Failed to validate OpenAPI spec:<ul>
<li>[/paths/~1pets~1{id}/get/parameters/1] Parameter &#39;required&#39; must be true for &#39;in&#39;: &#39;path&#39;.</li>
</ul>
        )

)
```

and code generation fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant