설정을 마쳤습니다. write API를 호출할 때 Request Body에 필요한 필드가 빠져 있다면 400 오류를 응답하게 되는데, 응답 내용에 에러를 함께 반환합니다. 직접 tags 배열을 제외하고 API 요청을 한번 해 보세요.
POST http://localhost:4000/api/posts { "title": "제목", "body": "내용" }
응답이 다음과 같이 나타납니다.
{
"isJoi": true,
"name": "ValidationError",
"details": [
{
"message": "\"tags\" is required",
"path": [
"tags"
],
"type": "any.required",
"context": {
"key": "tags",
"label": "tags"
}
}
],
"_object": {
"title": "제목",
"body": "내용"
}
}