Closed shufo closed 2 years ago
Hi. Thanks for creating the great document generator. Recently I used this and it helped me a lot.
I'd like to ask about a behavior I noticed when I was using the Try it out feature.
What happened?
Try it out
e.g.
I would like to know if is this a intended behaviour?
When I fix the source below to check if value is empty, it works as expected.
https://github.com/knuckleswtf/scribe/blob/df677461933d26b521e3dd71c5d7bf3b9b0f30c7/resources/js/tryitout.js#L221-L223
Fixed code:
if (el.type !== "radio" || (el.type === "radio" && el.checked)) { if (el.value !== "" && el.required === false) { _.set(query, el.name, el.value); } }
The body parameter appears to work as expected as it does not send any parameters when input is empty.
If this behavior is unintended, please let me know and I will send a PR.
My environment:
php -v
➜ ~ php -v PHP 8.1.6 (cli) (built: May 25 2022 19:55:01) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.6, Copyright (c) Zend Technologies with Zend OPcache v8.1.6, Copyright (c), by Zend Technologies
composer show laravel/framework
composer show laravel/lumen-framework
composer show knuckleswtf/scribe
My Scribe config (minus the comments):
Additional info:
It's not intended. Sure, you can send in a PR.
Hi. Thanks for creating the great document generator. Recently I used this and it helped me a lot.
I'd like to ask about a behavior I noticed when I was using the Try it out feature.
What happened?
Current Behaviour
Try it out
feature with optional query parameter empty.e.g.
Try it out
client sends request with empty query parameter.Expect Behaviour
I would like to know if is this a intended behaviour?
When I fix the source below to check if value is empty, it works as expected.
https://github.com/knuckleswtf/scribe/blob/df677461933d26b521e3dd71c5d7bf3b9b0f30c7/resources/js/tryitout.js#L221-L223
Fixed code:
The body parameter appears to work as expected as it does not send any parameters when input is empty.
If this behavior is unintended, please let me know and I will send a PR.
My environment:
php -v
):composer show laravel/framework
orcomposer show laravel/lumen-framework
): v8.83.14composer show knuckleswtf/scribe
): 3.33.0My Scribe config (minus the comments):
Config
``` reduce( fn($carry, $item, $key) => sprintf('%s %s: %s', $carry, Str::lower($key), $item) ); return [ 'theme' => 'default', 'title' => '~~~', 'description' => '~~~', 'base_url' => '~~', 'routes' => [ [ 'match' => ['prefixes' => ['api/*'], 'domains' => ['*'], 'versions' => ['v1']], 'include' => [], 'exclude' => [], 'apply' => [ 'headers' => [ 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Device-Type' => '1', 'App-Version' => '1.0.0', ], 'response_calls' => [ 'methods' => ['GET'], 'config' => ['app.env' => 'documentation'], 'queryParams' => [], 'bodyParams' => [], 'fileParams' => [], 'cookies' => [], ], ], ], ], 'type' => 'static', 'static' => ['output_path' => './public/docs'], 'laravel' => ['add_routes' => true, 'docs_url' => '/docs', 'middleware' => [], 'assets_directory' => null], 'try_it_out' => [ 'enabled' => true, 'base_url' => '~~~', 'use_csrf' => false, 'csrf_url' => '/sanctum/csrf-cookie', ], 'auth' => [ 'enabled' => true, 'default' => true, 'in' => 'bearer', 'name' => 'key', 'use_value' => env('SCRIBE_AUTH_KEY'), 'placeholder' => '{ACCESS_TOKEN}', 'extra_info' => <<Additional info: