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

Route not defined #349

Closed
ghost opened this issue Dec 8, 2020 · 5 comments
Closed

Route not defined #349

ghost opened this issue Dec 8, 2020 · 5 comments

Comments

@ghost
Copy link

ghost commented Dec 8, 2020

  • L5-Swagger Version: 8.0.4 (composer show | grep l5-swagger)
  • PHP Version (php -v): 7.4.12
  • OS: Ubuntu 16 LTS

Description:

I made a multiple configuration:

        'default' => [
            'api' => [
                'title' => 'API',
            ],

            'routes' => [
                /*
                 * Route for accessing api documentation interface
                */
                'api' => 'documentation',
            ],
            'paths' => [
                /*
                 * File name of the generated json documentation file
                */
                'docs_json' => 'api-docs.json',

                /*
                 * File name of the generated YAML documentation file
                */
                'docs_yaml' => 'api-docs.yaml',

                /*
                 * Absolute paths to directory containing the swagger annotations are stored.
                */
                'annotations' => [
                    base_path('app/Api/V1'),
                    base_path('app/Http/Controllers/P'),
                    base_path('app/Models/P'),
                ],

            ],
        ],
        'staging' => [
            'api' => [
                'title' => 'API staging',
            ],

            'routes' => [
                /*
                 * Route for accessing api documentation interface
                */
                'api' => 'documentation/staging',
            ],
            'paths' => [
                /*
                 * File name of the generated json documentation file
                */
                'docs_json' => 'staging-docs.json',

                /*
                 * File name of the generated YAML documentation file
                */
                'docs_yaml' => 'staging-docs.yaml',

                /*
                 * Absolute paths to directory containing the swagger annotations are stored.
                */
                'annotations' => [
                    base_path('app/Staging'),
                    base_path('app/Http/Controllers/Staging/P'),
                    base_path('app/Models/Staging/P'),
                ],

            ],
        ],
    ],

But when I go to for example: documentation/v2, I got the following error: Route [l5-swagger.staging.docs] not defined.

Steps To Reproduce:

  • Build multiple documentation
  • Go to the url

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@daniel-rees
Copy link

The route resolves, and artisan route:list shows this named route correctly.

That was the extent of my invstigation, but +1 on this

@ghost
Copy link
Author

ghost commented Dec 9, 2020

@daniel-rees When I check artisan route:list the named route is not showing.

@nik-bil-svoboden
Copy link

Hi @Mirkin-source
To make this finally work I had to add a 'docs' and 'oauth2_callback' routes to both of my documentations.*.routes section.

You need to add to your config something like this:

   'default' => [
            'api' => [
                'title' => 'API',
            ],
            'routes' => [
                'api' => 'documentation',
                 'docs' => '/api/default/docs',
                'oauth2_callback' => '/api/default/callback',
            ],




   'staging' => [
            'api' => [
                'title' => 'API staging',
            ],
            'routes' => [
                'api' => 'documentation/staging',
                 'docs' => '/api/staging/docs',
                'oauth2_callback' => '/api/staging/callback',
            ],

I think this should be added to wiki.

@Maisaan
Copy link

Maisaan commented Sep 8, 2021

Great now the documents have been created and i can access my v1 and v2 endpoints but i want to enable the version dropdown as seen in this image from google. Any idea?

image

@DarkaOnLine
Copy link
Owner

Closing due to no activity for a very long time

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

No branches or pull requests

4 participants