JSON Schema Validation in JBoss EAP 7

Solution Verified - Updated -

Issue

We are using json-schema-core-1.2.5 to validate JSON messages against schemas. We are in the process of upgrading our applications from JBoss EAP 6.4.11 to 7.4.2. We have noticed that the JSON schema validation does not validate correctly when the schema declares an enum represented by numbers. e.g. a schema such as:

"request": {
  "type": "object",
  "properties": {"
    "id": { "type": "string" },
    "type": {
      "enum": [0, 1, 4, 5] 

does not validate against a request. But if the enum is change to "enum": ["0", "1", "4", "5"] and the request is change to pass the attribute as a string then it does validate. Investigating further shows that the change in behaviour is down to the uypdated jackson-databind version. In JBoss EAP 6.4.11, we were using jackson-databind 2.3.0. The latest version I have in our development environment that works correctly is 2.4.2. If I update to our next available version of 2.6.0 then the validation fails. The version of jackson-databind provided by JBoss EAP 7.4.2 appears to be 2.12.1 and I cannot configure the application to reference an included earlier version. I believe this issue is down to json representation of numbers in schemas and json requyests being different and the comparison of these json entities having issues.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.4.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content