DarkaOnLine / L5-Swagger

OpenApi or Swagger integration to Laravel

Home Page:https://github.com/DarkaOnLine/L5-Swagger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Route [l5-swagger.<name>.docs] not defined

andrey-helldar opened this issue · comments

  • L5-Swagger Version: 8.5.2
  • PHP Version: 8.3.3
  • OS: Windows 11 Pro

Description:

If two or more documentation files are generated, only the last one is opened.

For example:

return [
    'documentations' => [
        'foo' => [], // works
    ],
];
return [
    'documentations' => [
        'foo' => [], // doesnt works
        'bar' => [], // doesnt works
        'baz' => [], // works
    ],
];

image

Steps To Reproduce:

  1. Add a new documentation type, change file names. The source of data for generation can be left unchanged.
  2. Execute the php artisan l5-swagger:generate --all console command.
  3. See that the files have been successfully generated.
  4. Open the documentation URL and see that all but the last one return an error.

I found a crutch solution to the problem.

All you need to do is to add docs and oauth2_callback keys in the file configuration, specifying unique values.

For example:

return [
    'documentations' => [
        'foo' => [
            // ...
            'docs' => 'docs/foo',
            'oauth2_callback' => 'api/foo/oauth2-callback',
        ],

        'bar' => [
            // ...
            'docs' => 'docs/bar',
            'oauth2_callback' => 'api/bar/oauth2-callback',
        ],

        'baz' => [
            // ...
            'docs' => 'docs/bar',
            'oauth2_callback' => 'api/bar/oauth2-callback',
        ],
    ],
];