We use Jackson for parsing JSON data in our RESTFul API, our models also
automatically validate the data so we mark properties as required, use
enums wherever possible etc. For example; if a required property is not
set, Jackson throws an exception:
Missing external type id property 'type'↵ at [Source: UNKNOWN; line: -1,
column: -1] (through reference chain: io.rakam...SqlReportOptions[
"variables"]->java.util.ArrayList[0])
For the data:
{"variables": [{"name": "test"}]}
We enforce the `type` property of each variable to be set so the error
message makes sense. However; we want to show the following error message
to the user:
variables[0].type is required.
We may catch the JacksonException and generate the error message but it
looks like it's not that easy. In JsonMappingException, there is
path object but we could generate the json path `variables[0].type` since
it uses class names instead of attribute names. Which path should we follow
in this case?
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.