Skip to content

Change validation logic

Choose a tag to compare

@ilya-shaydullin ilya-shaydullin released this 01 Jun 07:46
· 33 commits to master since this release
5bbc599

Refactoring package com.icerockdev.api.Request

Migration guide:

  • Replace request.isValid() and request.isValidRecursive() to request.validate() and request.validRecursive(), respectively.
  • For get list of error need call request.getErrorList().

Example:

post("/object") {
          val request = call.receiveRequest<TestRequest>()
          if (!request.validate()) {
               throw ValidationException(request.getErrorList())
          }
          call.respond(TestResponse2(200, request.email, request.password))
}