Bu mükemmel bir çözümdür ama biraz o kadar KURU amacıyla yaptık sanmıyorum. Gelen
root swagger schema Eğer Havalı Spec ile tanımlanan bir responses
nesneyi tanımlamak:
bir amacı operasyon arasında kullanılabilir yanıtları tutmak için. Bu özelliği, tüm işlemler için genel yanıtları tanımlamaz. Eğer yolunda paylaşılan yanıtları başvuruda bulunabilir yaptıktan sonra
responses:
400:
description: Bad Request
schema:
$ref: '#/definitions/Error'
401:
description: Unauthorized
schema:
$ref: '#/definitions/Error'
403:
description: Forbidden
schema:
$ref: '#/definitions/Error'
500:
description: Internal Server Error
schema:
$ref: '#/definitions/Error'
definitions:
Error:
type: object
required:
- message
properties:
message:
type: string
description: 'The cause of the Error.'
. En azından
paths:
/keys/:
get:
summary: 'Get All API Keys the caller has access to view.'
responses:
200:
description: 'Successfully got Keys'
schema:
$ref: '#/definitions/ApiKeyResponse'
400:
$ref: '#/responses/400'
401:
$ref: '#/responses/401'
500:
$ref: '#/responses/500'
bu response
açıklama ve bu yanıt türü için tanımlanan herhangi şema konusunda size bir kıvam alıncaya. Tüm yaygın hata yanıtlarını gruplamak için bir yol bulmayı umuyordum ve sadece gruba referans veriyordum ama bunu yapmanın bir yolunu bulamadım.
Btw, çoğaltmayı önlemek için varsayılan yanıtlara sahip olmanız için bir özellik isteğinde bulunuyor: https://github.com/OAI/OpenAPI-Specification/issues/563. – Helen