Apr 18, 2025
0
Level 1
how to document 422 response (openapi)
What is the correct way to document errors. I have tried :
"responses": {
"201": {
"description": "Created successfully"
},
"422": {
"description": "Unprocessable entity",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "<Field> required and 2 more errors."
},
"errors": {
"type": "array",
"items": {
"type": "object",
"properties": {
"<field-name>": {
"type": "string",
"examlpe": "<Field> required"
}}}}}}}}}}
Please or to participate in this conversation.