get_body_field
Get a ModelField representing the request body for a path operation, combining all body parameters into a single field if necessary.
def get_body_field(
flat_dependant: Dependant,
name: str,
embed_body_fields: bool
) - > ModelField | None
Get a ModelField representing the request body for a path operation, combining all body parameters into a single field if necessary. Used to check if it's form data (with isinstance(body_field, params.Form)) or JSON and to generate the JSON Schema for a request body. This is not used to validate/parse the request body, that's done with each individual body parameter.
Parameters
| Name | Type | Description |
|---|---|---|
| flat_dependant | Dependant | The Dependant object containing information about the path operation's dependencies, including body parameters. |
| name | str | The name of the path operation, used to construct the name of the combined body model. |
| embed_body_fields | bool | A boolean indicating whether to combine multiple body parameters into a single embedded ModelField. |
Returns
| Type | Description |
|---|---|
| `ModelField | None` |