You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "thomascube (via GitHub)" <gi...@apache.org> on 2025/03/03 12:23:56 UTC

[I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

thomascube opened a new issue, #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077

   ### Bug description
   
   We're using the JSON Schema validator in a Quarkus application which is distributed as native binary.
   While the JVM version generates proper and human-readable validation error messages, the messages differ and become rather cryptic when running the app as native binary.
   
   This is how we validate a json string against a schema:
   
   ```java
   final JsonNode node = objectMapper.readTree(jsonString);
   final Set<ValidationMessage> errors = schema.validate(node);
   if (!errors.isEmpty()) {
     // print out errors.stream().map(ValidationMessage::getMessage).collect(Collectors.joining("; ")
   }
   ```
   
   Here's how this looks like when running the jar:
   ```
   $.pipelines[0].customParameters[0]: required property 'values' not found; $.pipelines[0].customParameters[0]: property 'value' is not defined in the schema and the schema does not allow additional properties 
   ```
   
   The same json validation error prints like this in the native binary:
   ```
   required; additionalProperties 
   ```
   
   I assume this is related to reflection and missing classes being registered for reflection. However, I wasn't able to figure out which classes I have to register for reflection. Please help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "thomascube (via GitHub)" <gi...@apache.org>.
thomascube commented on issue #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077#issuecomment-2706422596

   @jamesnetherton Many thanks for your help and clarification!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "thomascube (via GitHub)" <gi...@apache.org>.
thomascube commented on issue #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077#issuecomment-2695513961

   Thanks @jamesnetherton. Unfortunately both suggestions (together) didn't solve the issue. The native binary still prints these cryptic validation errors.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on issue #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077#issuecomment-2703251918

   > quarkus.native.resources.includes=jsv-messages.properties
   
   I am a bit confused why it would be required TBH. There's some native build configuration within the `json-schema-validator` JAR that handles resources etc:
   
   https://github.com/networknt/json-schema-validator/blob/master/src/main/resources/META-INF/native-image/com.networknt/json-schema-validator/resource-config.json
   
   So unless you're using a really old version of `json-schema-validator` < 1.3.3, it should work OOTB.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on issue #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077#issuecomment-2695529658

   If can you put together a test case or application that replicates the problem. It'd help us to find the issue root cause.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on issue #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077#issuecomment-2703687655

   This seems to be working ok in the context of a Camel Quarkus application.
   
   If you're using `json-schema-validator` standalone, then that's not something we really support in this project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on issue #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077#issuecomment-2694263884

   It's probably due to missing resource bundles. Try building with the following configuration in `application.properties`:
   
   ```
   quarkus.native.additional-build-args=-H:IncludeResourceBundles=com.networknt.schema.i18n.ResourceBundleMessageSource
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on issue #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077#issuecomment-2694490829

   You may also need to add `quarkus-jackson` to the application if it's not already there. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "thomascube (via GitHub)" <gi...@apache.org>.
thomascube commented on issue #7077:
URL: https://github.com/apache/camel-quarkus/issues/7077#issuecomment-2698094459

   I meanwhile found a solution myself. After many more attempts of trial-and-error the messages are now as expected in the native binary. In the end it was sufficient to set
   ```
   quarkus.native.resources.includes=jsv-messages.properties
   ```
   This works for me even without adding the `quarkus-jackson` module or the `additional-build-args`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] NetworkNT JSON Schema: different validationMessages in native Quarkus application [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton closed issue #7077: NetworkNT JSON Schema: different validationMessages in native Quarkus application
URL: https://github.com/apache/camel-quarkus/issues/7077


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org