- changed status to resolved
Incorrent error message when parsing incorrent date-time format
Issue #54
resolved
When I have format: date-time in header 'Last-Modified': I got error message:
[ERROR] Unable to parse JSON - Unrecognized token 'Wed': was expecting ('true', 'false' or 'null')
at [Source: Wed, 21 Jun 2017 14:59:37 GMT; line: 1, column: 4].
Specification example:
"/users/me": {
"get": {
"tags": [
"User"
],
"summary": "Get user profile info",
"operationId": "User_Get",
"description": "Profile info and Last-Modified header.",
"responses": {
"200": {
"description": "Profile info",
"headers": {
"Last-Modified": {
"description": "Date profile modified",
"type": "string",
"format": "date-time"
}
},
"schema": {
"$ref": "#/definitions/User"
}
},
"500": {
"description": "Internal server error"
}
}
}
According to swagger spec: date-time format is valid "yyyy-MM-dd'T'HH:mm:ssZ" format, but Last-Modified date format is "EEE, dd MMM yyyy HH:mm:ss zzz"
Expected result: Proper error handling when date-time from header not match as in spec
Actual result:
[ERROR] Unable to parse JSON - Unrecognized token 'Wed': was expecting ('true', 'false' or 'null')
at [Source: Wed, 21 Jun 2017 14:59:37 GMT; line: 1, column: 4].
Additional Info: I know my swagger spec contain wrong date-time format, but it cause parsing error. When I delete format: date-time from swagger spec, all is OK.
Comments (1)
-
- Log in to comment
Available in v1.2.1