Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to make request body mandatory #1011

@vrjram

Description

@vrjram

Hi,
I have a code segment as below:

@app.post('/infer/')
async def infer(request: Request = Body(...)):

But in the API spec, the request body is not defined as a mandatory field. Infact there is no body.

"/infer/": {
            "post": {
                "summary": "Infer",
                "operationId": "infer_infer__post",
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    }
                }
            }
        }

Is there any additional steps required to make this mandatory. Please advice.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions