drf-yasg
drf-yasg copied to clipboard
[Custom schema generation] for request_body not working
Hi,
I was working with custom schema generation for request body. The request are going through.
I have defined the email field as required but it's not working . The request are sill going through resulting in error. My aim is to through an error {This field is required} if the data is not provided.
@swagger_auto_schema(
method='post',
request_body=openapi.Schema(
type=openapi.TYPE_OBJECT,
title="Request OTP",
required=["email"],
properties={
"email": openapi.Schema(
title="Email",
type=openapi.TYPE_STRING,
format=openapi.FORMAT_EMAIL,
),
},
),
responses={
200: "Success",
400: "Invalid Request"
})
Thanks for the help.