MCPcopy
hub / github.com/pydantic/pydantic / is_required

Method is_required

pydantic/fields.py:746–752  ·  view source on GitHub ↗

Check if the field is required (i.e., does not have a default value or factory). Returns: `True` if the field is required, `False` otherwise.

(self)

Source from the content-addressed store, hash-verified

744 )
745
746 def is_required(self) -> bool:
747 """Check if the field is required (i.e., does not have a default value or factory).
748
749 Returns:
750 `True` if the field is required, `False` otherwise.
751 """
752 return self.default is PydanticUndefined and self.default_factory is None
753
754 def rebuild_annotation(self) -> Any:
755 """Attempts to rebuild the original annotation for use in function signatures.

Callers 15

__repr_args__Method · 0.95
model_constructMethod · 0.80
_common_field_schemaMethod · 0.80
collect_model_fieldsFunction · 0.80
_iterFunction · 0.80
create_partialFunction · 0.80

Calls

no outgoing calls

Tested by 8

create_partialFunction · 0.64
test_recursive_listsFunction · 0.64
test_fieldsFunction · 0.64
test_create_modelFunction · 0.64