laravel-openapi icon indicating copy to clipboard operation
laravel-openapi copied to clipboard

Factory class must be instance of ResponseFactory when running openapi:generate

Open LeeoSilva opened this issue 4 years ago • 1 comments

While using php artisan openapi:generate we can run into this exception:

image

This happens when your response class doesn't extend from Vyuldashev\LaravelOpenApi\Factories\ResponseFactory or straight up doesn't exist in the path you specified in the annotation of your controller method. My suggestion would be to specify the Factory that generated this error in the exception message so it can help future devs debug their code.

LeeoSilva avatar Feb 26 '21 15:02 LeeoSilva

if anyone wonders, changing from #[OpenApi\Response(factory: AnResponse::class)] to #[OpenApi\Response(factory: \App\OpenApi\Responses\AnResponse::class)] fixes this error for me

jiechaowang avatar Apr 05 '22 16:04 jiechaowang