MCPcopy Index your code
hub / github.com/fastapi/fastapi / Body

Class Body

fastapi/params.py:469–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467
468
469class Body(FieldInfo): # type: ignore[misc] # ty: ignore[subclass-of-final-class]
470 def __init__(
471 self,
472 default: Any = Undefined,
473 *,
474 default_factory: Callable[[], Any] | None = _Unset,
475 annotation: Any | None = None,
476 embed: bool | None = None,
477 media_type: str = "application/json",
478 alias: str | None = None,
479 alias_priority: int | None = _Unset,
480 validation_alias: str | AliasPath | AliasChoices | None = None,
481 serialization_alias: str | None = None,
482 title: str | None = None,
483 description: str | None = None,
484 gt: float | None = None,
485 ge: float | None = None,
486 lt: float | None = None,
487 le: float | None = None,
488 min_length: int | None = None,
489 max_length: int | None = None,
490 pattern: str | None = None,
491 regex: Annotated[
492 str | None,
493 deprecated(
494 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."
495 ),
496 ] = None,
497 discriminator: str | None = None,
498 strict: bool | None = _Unset,
499 multiple_of: float | None = _Unset,
500 allow_inf_nan: bool | None = _Unset,
501 max_digits: int | None = _Unset,
502 decimal_places: int | None = _Unset,
503 examples: list[Any] | None = None,
504 example: Annotated[
505 Any | None,
506 deprecated(
507 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, "
508 "although still supported. Use examples instead."
509 ),
510 ] = _Unset,
511 openapi_examples: dict[str, Example] | None = None,
512 deprecated: deprecated | str | bool | None = None,
513 include_in_schema: bool = True,
514 json_schema_extra: dict[str, Any] | None = None,
515 **extra: Any,
516 ):
517 self.embed = embed
518 self.media_type = media_type
519 if example is not _Unset:
520 warnings.warn(
521 "`example` has been deprecated, please use `examples` instead",
522 category=FastAPIDeprecationWarning,
523 stacklevel=4,
524 )
525 self.example = example
526 self.include_in_schema = include_in_schema

Callers 15

sum_numbersFunction · 0.90
sum_numbersFunction · 0.90
sum_numbersFunction · 0.90
sum_numbersFunction · 0.90
update_itemFunction · 0.90
update_itemFunction · 0.90
update_itemFunction · 0.90
update_itemFunction · 0.90
update_itemFunction · 0.90
update_itemFunction · 0.90
upsert_itemFunction · 0.90
upsert_itemFunction · 0.90

Calls

no outgoing calls

Tested by 15

send_body_embedFunction · 0.72
create_pet_assignmentFunction · 0.72
create_pet_annotatedFunction · 0.72
examplesFunction · 0.72
getFunction · 0.72
test_body_repr_strFunction · 0.72
test_body_repr_noneFunction · 0.72
test_body_repr_ellipsisFunction · 0.72
test_body_repr_numberFunction · 0.72
test_body_repr_listFunction · 0.72
exampleFunction · 0.72
examplesFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…