json – Javax validation with JsonProperty replacements

Sorry if this belongs to the software design stack or something similar called:
Given a typical bean with nested beans and no loops, it is interspersed with JsonProperty uses. Obviously javax doesn't care about these, so when generating the & # 39; propertyPath & # 39; field names appear and not JsonProperty values.

A particular problem is my use of the Jackson subtypes. This set of interfaces (yes, set) matches the existing field to determine the specific implementation.

Current ideas: (all using Path.iterator ())

  • Cache the output of all code field paths that contain a JsonProperty annotation in a tree and apply overrides until there are no more child elements, with the rest (if any) added to the end.
  • Manually interpret the JsonSubtypes and filter the instance into collections.
  • Just don't use Set and only List when working with JSON inputs.

    I'm looking for other opinions, as I can't be the only one who ran into this problem. I am leaning towards the latter despite the work involved to do so. (currently only liability issues). I was hoping there would be a better way to access the actual bean references, but I was only given the validated root object and the leaf bean where the violation occurs, nothing in between.

    Relevant API:

  • ConstraintViolation.java
  • Path
  • Path.Node