Dmitrii  Adonin Dmitrii Adonin - 1 year ago 144
JSON Question

JSR-303 activation in jsonschema2pojo

There is a place in jsonschema2pojo documentation describing possibility to enable JSR-303 annotations generation. If I understand correctly it can be done via Maven plugin configuration. Could someone show how to accomplish it, which tag in plugin configuration should be used? Thanks to all!

Answer Source

I think you are looking for the includeJsr303Annotations parameter. See the plugin documentation:


Whether to include JSR-303 annotations (for schema rules like minimum, maximum, etc) in generated Java types. Schema rules and the annotation they produce:

Any Java fields which are an object or array of objects will be annotated with @Valid to support validation of an entire document tree.

  • Type: boolean
  • Since: 0.3.2
  • Required: No
  • Expression: ${jsonschema2pojo.includeJsr303Annotations}
  • Default: false

It can be used as following:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download