From c6ca9e2741d1dc2876ea50563705385f99868d0c Mon Sep 17 00:00:00 2001 From: David Bruno Vontor Date: Tue, 6 Jan 2026 16:42:29 +0100 Subject: [PATCH] Update copilot-instructions.md --- .github/copilot-instructions.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index b76f786..c97d8b5 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -33,6 +33,10 @@ This monorepo contains a Django backend and a Vite/React frontend, orchestrated - Static/media files: S3 in production, local in dev (see `settings.py`). - API versioning and docs: DRF Spectacular config in `settings.py`. - Custom permissions, filters, and serializers in each app. + - **Serializer Best Practices**: + - **Prevent Duplicate Schemas**: When the same `ChoiceField` or complex field appears in multiple serializers, define it once as a reusable field class and use it everywhere instead of repeated definitions. + - Example: Create `OrderStatusField(serializers.ChoiceField)` with `choices=Order.OrderStatus.choices` and reuse it in all serializers that need order status. + - This ensures consistent OpenAPI schema generation and reduces maintenance overhead. - **Frontend** - Use React Router layouts for shared UI (see `src/layouts/`, `LAYOUTS.md`). - API calls and JWT handling in `src/api/`.