Eksik API yanıt tipi (ARCH7201)
Anahtar php.quality.missing-api-response · Önem info · Kategori quality
Yanıt şemasını veya durum kodlarını bildirmeyen denetleyici eylemleri, üretilen OpenAPI dokümantasyonunu eksik bırakır. Yanıt tiplerini açıkça belirtin.
Hatalı
Bölüm başlığı “Hatalı”<?php#[Route('/users/{id}', methods: ['GET'])]public function show(int $id){ return $this->json($this->repo->find($id));}<?php#[Route('/users/{id}', methods: ['GET'])]#[OA\Response(response: 200, description: 'User', content: new OA\JsonContent(ref: User::class))]#[OA\Response(response: 404, description: 'Not found')]public function show(int $id): JsonResponse{ return $this->json($this->repo->find($id));}Düzeltme
Bölüm başlığı “Düzeltme”Her HTTP eylemine yanıt şemasını ve döndürülen durum kodlarını bildiren anotasyonlar ekleyin.