Skip to content

Commit 34ac30c

Browse files
committed
improve docs
1 parent 61e7055 commit 34ac30c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

docs/advanced/joins.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,17 +236,13 @@ user_model = await user_crud.get_joined(
236236
# Result: UserWithTier(id=1, name="Example", tier_id=1, tier_name="Free")
237237
```
238238

239-
!!! TIP "Schema Design for Joined Data"
239+
!!! NOTE "`return_as_model` Usage Notes"
240240

241-
When using `return_as_model=True`, ensure your schema includes all the fields that will be present in the flattened result, including joined fields with their prefixes.
242-
243-
!!! NOTE "Required Parameters"
244-
245-
When `return_as_model=True`, the `schema_to_select` parameter is required. FastCRUD will raise a `ValueError` if you try to use `return_as_model=True` without providing a schema.
246-
247-
!!! WARNING "join_prefix and return_as_model Compatibility"
248-
249-
When using `return_as_model=True` with `nest_joins=True`, ensure that your `join_prefix` (minus trailing "_") matches the field name in your Pydantic schema. Otherwise, FastCRUD will raise a `ValueError` with clear guidance on how to fix the mismatch.
241+
**Required Parameters**: When `return_as_model=True`, the `schema_to_select` parameter is required. FastCRUD will raise a `ValueError` if you try to use `return_as_model=True` without providing a schema.
242+
243+
**Schema Design**: Ensure your schema includes all the fields that will be present in the flattened result, including joined fields with their prefixes.
244+
245+
**Nested Joins Compatibility**: When using `return_as_model=True` with `nest_joins=True`, ensure that your `join_prefix` (minus trailing "_") matches the field name in your Pydantic schema. Otherwise, FastCRUD will raise a `ValueError` with clear guidance on how to fix the mismatch.
250246

251247
**❌ This will raise an error:**
252248
```python

0 commit comments

Comments
 (0)