REST API - How do I get the Bean Validation message?

I’m trying to implement bean validation with guidance from the docs, but it just doesn’t seem to be working as expected.

The validation is functioning properly - it errors out when it should. app.log is showing the proper validation message. But the REST API does not return this message. The response shows, roughly, the following:


{
  message: "",
  response: {...}
}

The message is empty, whether I return a custom validation message or not.

I’m guessing that I missed a step, or something. Any ideas on what that could be?

The service method I am testing is as follows in the interface:


    @Validated
    @NotNull
    ServiceResult<Pdetail> reactivateLineitem(
            @NotNull
            Pdetail lineitem,
            Date startDate,
            @Future(message = "Date must be in the future")
            Date endDate,
            BigDecimal amount
    );

The code I’m using to call the service (the parameters include a date that is well within the past, so as to trigger the @Future constraint):


this.app.invokeService("muaipm_AccountService", "reactivateLineitem", this.params_reactivate, {
  handleAs: "json"
}).then(function(response) {
  ...
}.bind(this)).catch(function(response) {
  console.log(response)
  console.log(response.message)
}.bind(this))

I am strictly using the Polymer front end, and haven’t touched the GUI.
Platform 6.6.4

What am I missing?

Hi
try to add @Validated annotation also to validated parameters, like @Validated @NotNull and so on, then report back here…

P.

I tried your recommendation, but unfortunately it didn’t change anything.

Sheepishly I must admit that I just didn’t use the Javascript API properly.

What worked was to do as follows:


this.app.invokeService("muaipm_AccountService", "reactivateLineitem", this.params_reactivate, {
  handleAs: "json"
}).then(function(response) {
  ...
}.bind(this)).catch(function(response) {
  response.response.json().then(function(json) {
    json.forEach(function(error) {
      console.log(error.message)
    }
  })
}.bind(this))

Specifically, the (simplified) .response.json().then((json) => json[some_index].message).

Thanks for your willingness to help!