Desidero che quasi tutti i miei percorsi abbiano le seguenti 3 risposte di errore generiche. Come posso descriverlo in Swagger senza copypasting di queste righe ovunque?Come non copiare e incollare 3 risposte di errore generiche in quasi tutti i percorsi?
401:
description: The requester is unauthorized.
schema:
$ref: '#/definitions/Error'
500:
description: "Something went wrong. It's server's fault."
schema:
$ref: '#/definitions/Error'
503:
description: Server is unavailable. Maybe there is maintenance?
schema:
$ref: '#/definitions/Error'
Esempio di come io uso questo in una richiesta:
paths:
/roles:
get:
summary: Roles
description: |
Returns all roles available for users.
responses:
200:
description: An array with all roles.
schema:
type: array
items:
$ref: '#/definitions/Role'
401:
description: The requester is unauthorized.
schema:
$ref: '#/definitions/Error'
500:
description: "Something went wrong. It's server's fault."
schema:
$ref: '#/definitions/Error'
503:
description: Server is unavailable. Maybe there is maintenance?
schema:
$ref: '#/definitions/Error'
Questo non funziona con spavalderia-Codegen. .. –