Skip to content
Discussion options

You must be logged in to vote

Hey @mcorten! Cool, you're almost there! The only thing left is to inject a generator instance into the route's handler, and invoke it with the configuration (the generator instance is invokable). The result of the invocation is the OpenAPI document you're looking for.

use Dedoc\Scramble\Generator;

Route::get('/api/****/***', function (Generator $generator) {
    if (App::isLocal()) {
        return view('scramble::docs', [
            'config' => $config = Scramble::getGeneratorConfig('default'),
            'spec' => $generator($config),
        ]);
    }

    /* return a cached version of the api.json for staging and production */
    if (App::isProduction()) {
        return view('sc…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mcorten
Comment options

Answer selected by mcorten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants