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

Function get_model_fields

fastapi/_compat/v2.py:395–410  ·  view source on GitHub ↗
(model: type[BaseModel])

Source from the content-addressed store, hash-verified

393
394
395def get_model_fields(model: type[BaseModel]) -> list[ModelField]:
396 model_fields: list[ModelField] = []
397 for name, field_info in model.model_fields.items():
398 type_ = field_info.annotation
399 if lenient_issubclass(type_, (BaseModel, dict)) or is_dataclass(type_):
400 model_config = None
401 else:
402 model_config = model.model_config
403 model_fields.append(
404 ModelField(
405 field_info=field_info,
406 name=name,
407 config=model_config,
408 )
409 )
410 return model_fields
411
412
413@lru_cache

Callers 2

get_cached_model_fieldsFunction · 0.85

Calls 2

lenient_issubclassFunction · 0.90
ModelFieldClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…