hapi-openapi
hapi-openapi copied to clipboard
On outputvalidation true, the invalid date-time value results in 500 Internal Server Error
With outputvalidation sets to true, if the response has data time field in it and has wrong type value, the entire result fails with 500 response code.
eg:
DataResponse -
{
name: "test", audit:{"created_at": "test"}
}
If the response schema is
DataResponse:
type: object
description: "stock model"
properties:
name:
type: string
description: "stock model"
example: "XYZ"
audit:
$ref: '#/definitions/Audit'
required:
- name
- audit
Audit:
type: object
description: "audit on the stock view"
properties:
created_at:
title: Created At
description: "when the object is created"
type: string
readOnly: true
format: date-time
yo --version - 3.1.0
What is the expected result? If server is validating response, and response is wrong, it is a server error.
Actually the date is passed from request. And in that case it should throw 400 with proper error message, right?