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

2nd config for different api set for mobile not working #682

Closed
1 task done
jackkitley opened this issue Jun 9, 2023 · 5 comments
Closed
1 task done

2nd config for different api set for mobile not working #682

jackkitley opened this issue Jun 9, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@jackkitley
Copy link

Scribe version

4.21.2

PHP version

8.2.6

Framework

Laravel

Framework version

10.13.2

Scribe config

994d360921a2:/var/www/html$ php artisan scribe:config --config=mobile_scribe
Laravel Framework 10.13.2

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands for the "scribe:config" namespace:
  scribe:config:diff  Dump your changed config to the console. Use this when posting bug reports

What happened?

php artisan scribe:config --config=mobile_scribe

I created another config to generate another doc to separate my routes for mobile.

It doesnt generate the routes for laravel. 404 not found.

Docs

@jackkitley jackkitley added bug Something isn't working triage labels Jun 9, 2023
@jackkitley
Copy link
Author

jackkitley commented Jun 9, 2023

Issue is that the route generated is not dynamic to the config set.

`
$prefix = config('scribe_mobile.laravel.docs_url', '/docs');
$middleware = config('scribe_mobile.laravel.middleware', []);

Route::middleware($middleware)
->group(function () use ($prefix) {
Route::view($prefix, 'scribe.index')->name('scribe');

    Route::get("$prefix.postman", function () {
        return new JsonResponse(Storage::disk('local')->get('scribe/collection.json'), json: true);
    })->name('scribe_mobile.postman');

    Route::get("$prefix.openapi", function () {
        return response()->file(Storage::disk('local')->path('scribe/openapi.yaml'));
    })->name('scribe_mobile.openapi');
});

`

@shalvah
Copy link
Contributor

shalvah commented Jun 9, 2023

It's stated in the docs:

Screenshot_20230609-164939~2

Maybe I should move it to the beginning of the section so it's more obvious?

@shalvah shalvah closed this as completed Jun 9, 2023
@shalvah shalvah removed the triage label Jun 9, 2023
@jackkitley
Copy link
Author

jackkitley commented Jun 9, 2023 via email

@jackkitley
Copy link
Author

@shalvah I tried what was described in docs and i tried this way in routes before the other issues and i get the following:

If i set both to false in config then all works.

Screenshot 2023-06-09 at 20 48 21

@jackkitley
Copy link
Author

jackkitley commented Jun 10, 2023

Had to add two more routes to get openapi and postman.

Route::view('/mobile/docs', 'scribe_mobile.index')->name('scribe-mobile'); Route::get("scribe_mobile.postman", function () { return new JsonResponse(Storage::disk('local')->get('scribe_mobile/collection.json'), json: true); })->name('scribe_mobile.postman'); Route::get("scribe_mobile.openapi", function () { return response()->file(Storage::disk('local')->path('scribe_mobile/openapi.yaml')); })->name('scribe_mobile.openapi');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants