laravel-openapi
laravel-openapi copied to clipboard
Multiple parameter route
Hi, I have such issues with multiple parameter as follow:
I code route with 3 parameter, but cannot generate the doc.
Route::prefix('activity')->group(function () {
Route::GET('/{activity}/{personalflag}/{houseid}',
[
'as' => 'activity.show',
'uses' => 'ActivityController@show',
]);
});
Below is the error that I got while using 3 parameter at route.
Symfony\Component\Debug\Exception\FatalThrowableError : Argument 1 passed to Vyuldashev\LaravelOpenApi\SchemaHelpers::guessFromReflectionType() must be an instance of ReflectionType, null given, called in D:\xampp7.3.0\htdocs\laravel\layanesia\vendor\vyuldashev\laravel-openapi\src\Builders\Paths\Operation\ParametersBuilder.php on line 39
at D:\xampp7.3.0\htdocs\laravel\layanesia\vendor\vyuldashev\laravel-openapi\src\SchemaHelpers.php:10
6| use ReflectionType;
7|
8| class SchemaHelpers
9| {
> 10| public static function guessFromReflectionType(ReflectionType $reflectionType): Schema
11| {
12| switch ($reflectionType->getName()) {
13| case 'int':
14| return Schema::integer();
Exception trace:
1 Vyuldashev\LaravelOpenApi\SchemaHelpers::guessFromReflectionType()
D:\xampp7.3.0\htdocs\laravel\layanesia\vendor\vyuldashev\laravel-openapi\src\Builders\Paths\Operation\ParametersBuilder.php:39
2 Vyuldashev\LaravelOpenApi\Builders\Paths\Operation\ParametersBuilder::Vyuldashev\LaravelOpenApi\Builders\Paths\Operation\{closure}(["houseid"])
[internal]:0
Please use the argument -v to see more details.
Also experienced this, it seems to looking at the variable name rather than type You can hack around if it you edit line 39 to add some if conditions to handle specific cases to return Schema::integer(), Schema::string(), etc. but would be great to fix this up
could you please paste your controller and action definition (without contents)?
public function show($id, $layMyPersonalFlag, $houseid)