Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-6097

Error response handling from bean validation ignores Accept header

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • None
    • 10.0.0.Final
    • REST
    • None
    • Hide

      1 - Create the datasource (here's the relevant XML)

      <datasource jndi-name="java:jboss/datasources/WalmartDS" pool-name="WalmartDS" enabled="true">
          <connection-url>jdbc:h2:~/h2/walmart_db;AUTO_SERVER=TRUE</connection-url>
          <driver-class>org.h2.Driver</driver-class>
          <driver>h2</driver>
          <security>
              <user-name>sa</user-name>
              <password>sa</password>
          </security>
      </datasource>
      

      2 - Deploy the ear file

      3 - Call the http://localhost:8080/walmart/rest/addLogisticsNetwork endpoint using below request (which will give you an error due to missing property in the JSON)

      {
      	"logisticsNetwork": [{
      		"sourceName": "a",
      		"destinyName": "b",
      		"distance": 3
      	}]
      }
      
      Show
      1 - Create the datasource (here's the relevant XML) <datasource jndi-name= "java:jboss/datasources/WalmartDS" pool-name= "WalmartDS" enabled= "true" > <connection-url> jdbc:h2:~/h2/walmart_db;AUTO_SERVER=TRUE </connection-url> <driver-class> org.h2.Driver </driver-class> <driver> h2 </driver> <security> <user-name> sa </user-name> <password> sa </password> </security> </datasource> 2 - Deploy the ear file 3 - Call the http://localhost:8080/walmart/rest/addLogisticsNetwork endpoint using below request (which will give you an error due to missing property in the JSON) { "logisticsNetwork" : [{ "sourceName" : "a" , "destinyName" : "b" , "distance" : 3 }] }

    Description

      Basically I have a very simple application that has request validation in the REST endpoints.

      According to the documentation of RESTEasy, I should get a JSON error response if I put "application/json" in Accept header in the request.
      https://docs.jboss.org/resteasy/docs/3.0.13.Final/userguide/html/Validation.html#d4e2472

      The mentioned feature worked just fine in Wildfly 9.0.2.Final. Now, however, it doesn't.
      I have tried to upgrade the dependencies in the pom.xml to use dependencies from Wildfly 10.0.0.Final, but still no luck. Though the attached application deploys just fine in Wildfly 9.0.2.Final and Wildfly 10.0.0.Final.

      In WF 9.0.2.Final I used to get the below error JSON

      {
      	"exception": null,
      	"fieldViolations": [],
      	"propertyViolations": [],
      	"classViolations": [],
      	"parameterViolations": [{
      		"constraintType": "PARAMETER",
      		"path": "registerLogisticsNetwork.arg0.name",
      		"message": "may not be null",
      		"value": ""
      	}],
      	"returnValueViolations": []
      }
      

      In WF 10.0.0.Final I get this:

      [PARAMETER]
      [registerLogisticsNetwork.arg0.name]
      [may not be null]
      []
      

      Attachments

        Issue Links

          Activity

            People

              rsigal@redhat.com Ronald Sigal
              darkness.renann@gmail.com Renann Prado (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: