Swagger validation fails for LocalDateTime format

Issue #239 new
Former user created an issue

When a LocalDateTime field is defined in the swagger, the validation fails with the following error

String "2019-09-10T22:45:55" is invalid against requested date format(s) [yyyy-MM-dd'T'HH:mm:ssZ, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}Z]

Comments (1)

  1. Sven Döring

    You get the error because the given date 2019-09-10T22:45:55 is invalid against the format.

    You can try it yourself: new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse("2019-09-10T22:45:55");
    That will throw a parse error: java.text.ParseException: Unparseable date: "2019-09-10T22:45:55"

    Your date should be: "2019-09-10T22:45:55-0700" or "2019-09-10T22:45:55Z". Those dates are valid against the format.

  2. Log in to comment