|
|
@ -210,13 +210,16 @@ def get_flat_dependant( |
|
|
|
|
|
|
|
|
|
|
|
def _get_flat_fields_from_params(fields: List[ModelField]) -> List[ModelField]: |
|
|
|
if not fields: |
|
|
|
return fields |
|
|
|
first_field = fields[0] |
|
|
|
if len(fields) == 1 and lenient_issubclass(first_field.type_, BaseModel): |
|
|
|
fields_to_extract = get_cached_model_fields(first_field.type_) |
|
|
|
return fields_to_extract |
|
|
|
return fields |
|
|
|
extracted_fields = [] |
|
|
|
|
|
|
|
for field in fields: |
|
|
|
if lenient_issubclass(field.type_, BaseModel): |
|
|
|
model_fields = get_cached_model_fields(field.type_) |
|
|
|
extracted_fields.extend(model_fields) |
|
|
|
else: |
|
|
|
extracted_fields.append(field) |
|
|
|
|
|
|
|
return extracted_fields |
|
|
|
|
|
|
|
|
|
|
|
def get_flat_params(dependant: Dependant) -> List[ModelField]: |
|
|
|