On Linux, the file system is case sensitive. This means that you could have files named file.php, File.php, and FILE.php in the same folder. The same applies for directory names.
Have you checked the directory names and filenames?
Try to run composer phpstan. What is the result?
Do you use Apache or nginx as webserver on linux?
If Apache: How is the Apache DocumentRoot configured?
Case sensitivity was my first thought too - but that wouldn’t explain (to me at least) why the entry in the group ‘/app/doc’ works but the one off the root ‘/docs’ fails
It’s served by an Apache server (in a docker container created from php:7.4-apache) with DocumentRoot set to the default.
phpstan shows nothing of note (nothing to do with Swagger anyhow).
C:\Users\Mark\PhpstormProjects\dgpservices> composer phpstan
> phpstan analyse src tests config --level=max -c phpstan.neon --no-progress --ansi
------ --------------------------------------------------------
Line src\Action\Document\AddDocumentAction.php
------ --------------------------------------------------------
63 Cannot access offset 'expiresat' on array|object|null.
67 Cannot access offset 'type' on array|object|null.
68 Cannot access offset 'owner' on array|object|null.
------ --------------------------------------------------------
------ ------------------------------------------------------------------------------------------------
Line src\Action\Document\GetDocumentAction.php
------ ------------------------------------------------------------------------------------------------
16 Property App\Action\Document\GetDocumentAction::$docservice has no typehint specified.
17 Property App\Action\Document\GetDocumentAction::$logger has no typehint specified.
19 Constructor of class App\Action\Document\GetDocumentAction has an unused parameter $responder.
------ ------------------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------------------------
Line src\Action\PatientSubmission\AddPatientUploadAction.php
------ ----------------------------------------------------------------------------------------------------------------
18 Property App\Action\PatientSubmission\AddPatientUploadAction::$patientUploadService has no typehint specified.
66 Cannot access offset 'note' on array|object|null.
67 Cannot access offset 'nhs_number' on array|object|null.
68 Cannot access offset 'account_uuid' on array|object|null.
69 Cannot access offset 'client_id' on array|object|null.
70 Cannot access offset 'type' on array|object|null.
71 Cannot access offset 'expiresat' on array|object|null.
------ ----------------------------------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------------------------
Line src\Domain\PatientUpload\Data\PatientUploadStatusData.php
------ ---------------------------------------------------------------------------------------------------------
25 Property App\Domain\PatientUpload\Data\PatientUploadStatusData::$status has no typehint specified.
26 Property App\Domain\PatientUpload\Data\PatientUploadStatusData::$description has no typehint specified.
------ ---------------------------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------------------------
Line src\Domain\PatientUpload\Service\PatientUploadService.php
------ ----------------------------------------------------------------------------------------------------------------
65 Parameter #4 $expiry of method MJLib\Document\Service\DocumentService::addDocument() expects DateTime|null,
string given.
75 Parameter #4 $message of method MJLib\Reply\ReposScript phpstan analyse src tests config --level=max -c phpstan.ne
on --no-progress --ansi handling the phpstan event returned with error code 1
itory\ReplyServer::send() expects string, string|false given.
------ ----------------------------------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------
Line src\Middleware\TranslatorMiddleware.php
------ ----------------------------------------------------------------------------------------------
61 PHPDoc tag @var for variable $user contains unknown class App\Domain\User\Data\UserAuthData.
� Learn more at https://phpstan.org/user-guide/discovering-symbols
64 Access to property $locale on an unknown class App\Domain\User\Data\UserAuthData.
� Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ----------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------------------------------
Line src\Middleware\UserAuthMiddleware.php
------ -------------------------------------------------------------------------------------------------------------
32 Property App\Middleware\UserAuthMiddleware::$auth has unknown class App\Domain\User\Service\UserAuth as its
type.
� Learn more at https://phpstan.org/user-guide/discovering-symbols
44 Parameter $auth of method App\Middleware\UserAuthMiddleware::__construct() has invalid typehint type
App\Domain\User\Service\UserAuth.
44 Parameter $auth of method App\Middleware\UserAuthMiddleware::__construct() has invalid typehint type
App\Domain\User\Service\UserAuth.
63 Class App\Domain\User\Data\UserAuthData not found.
� Learn more at https://phpstan.org/user-guide/discovering-symbols
65 Call to method setUser() on an unknown class App\Domain\User\Service\UserAuth.
� Learn more at https://phpstan.org/user-guide/discovering-symbols
------ -------------------------------------------------------------------------------------------------------------
[ERROR] Found 24 errors
C:\Users\Mark\PhpstormProjects\dgpservices>
Make sure that you don’t deploy the docs/ directory of the skeleton to your production server. If exists, try to delete the docs folder because it could the issue.
Interestingly, Postman does not get redirected (and works) fine with all variants of the path. So I thought it was a chrome browser issue.
Then I noticed this cookie being set in postman
webapp=mo33pojki4eabssbcd1c96lsil; path=/
So I think what I’m seeing is the OpenAPI page running some javascript which relocates the browser (SPA style) to ‘/’ . That’s why the path has to be specified with a trailing ‘/’. This whole thing may be a feature of the swagger stuff. And maybe your article on Swagger should be amended with this caveat.
Indeed, I had the same issue after changing my route from docs/v1 to /docs.
This has nothing to do with cookies or the Swagger UI JavaScript. It’s the apache rewrite rule in the first .htaccess file in combination with the docs/ directory of the project root. To fix it, clear your browser cache (because the redirect is cached) and set your Dockerfile WORKDIR to the public/ directory.
Example: WORKDIR /var/www/public
Edit: Removed WORKDIR. I meant the apache DocumentRoot.