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

Status code from controller it's just ignored

Open glorand opened this issue 2 years ago • 2 comments

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

glorand avatar Feb 10 '23 11:02 glorand

the same bug

indigoram89 avatar Mar 03 '23 07:03 indigoram89

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) );

vovanwin avatar May 29 '23 13:05 vovanwin