laravel-openapi
laravel-openapi copied to clipboard
Status code from controller it's just ignored
In documentation: "Even if the schema defines a status code, you must supply the status code in the controller method attributes, or only one response will be included in the result."
Even if I define a custom status code in controller level it's just ignored
the same bug
hi, I ran into this error, maybe you, like me, had a statically registered return response code in the "Response" class.
If you specify "ok" in the response, it doesn't matter what is specified in the attribute above the method, the responses will overwrite each other.
this returns the code 200
return Response::ok() ->description('users list') ->content( MediaType::json()->schema($response) );
this returns the code 422
return Response::unprocessableEntity() ->description('users list') ->content( MediaType::json()->schema($response) );