public function generate($filename)
    {
        $securityConfig = config('swagger-lume.security', []);

        if (is_array($securityConfig) && ! empty($securityConfig)) {
            $documentation = collect(
                json_decode(file_get_contents($filename))
            );

            $openApi3 = version_compare(config('swagger-lume.swagger_version'), '3.0', '>=');

            $documentation = $openApi3 ?
                $this->generateOpenApi($documentation, $securityConfig) :
                $this->generateSwaggerApi($documentation, $securityConfig);

            file_put_contents($filename, $documentation->toJson());
        }
    }