0

I am generating POJO using jsonschema2pojo plugin. This object has 100 variables where for only few variables which are of type array of String, I would like to accept simple string values as well.

Current schema for one such attribute is given below. I want to change it to accept to accept both array oof strings and string value.

"location" : { "type" : "string", }

  • So your source (input to the plugin) is JSONschema? And e.g. field `location` should be __either__ an _array/list of strings_ __or__ a _single string value_ ? Remember the resulting POJO/class field needs a "static" type. – hc_dev Apr 05 '20 at 17:07
  • yes the source is JSON Schema. The field location should be able to accept both String and array of Strings. For now I have declared the `type: any` which generates the field type as Object in POJO class. Disadvantage with this is, user can pass anything now. – Rajat Swain Apr 06 '20 at 07:14

0 Answers0