الأمثلة واستجابات الأخطاء
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
make the docs useful, not just generated.
الموضوعات المخطط لها
- Add a short
descriptionto each operation and field. - Add realistic examples for requests and responses so newcomers can copy them.
- Document the error responses (
400,404,409) with the Problem Details shape. - Undocumented errors force clients to guess.
- Use
@ApiResponseon operations, or a shared configuration for common errors.
تفاصيل المخطط المبدئي
عرض عملي
@Operation(summary = "Get a product")
@ApiResponse(responseCode = "404", description = "Product not found")
@GetMapping("/{id}")
ProductResponse get(@PathVariable long id) { ... }اختبر فهمك
Why document 404?
أظهر الإجابة
Clients need to know what can go wrong and what it looks like.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.