I am creating the POJOs using jsonschema2pojo on inputtype of JSON ( not Json schema ). I need to add the APIModelProperty annotation to each primitive field and I would like to use the value as value for "example" parameter.
@ApiModelProperty(example="2020-02-03T00:00:00.000Z")
I do not want to manually add this annotation to each field afterr the schema is generated. So, I am trying to write a custom annotator that will add this annotation. From the examples I have seen, I am trying to use the
@Override
public void propertyField(JFieldVar field,
JDefinedClass clazz,
String propertyName,
JsonNode propertyNode ) {
System.out.println("propertyName " + propertyName);
}
This gives me the key names from the JSON. I have 2 questions
- I want to add the @APIModelProperty annotation to each primitive field. How do I identify that propertyName field is a primitive and
- How do I get the value of propertyName?
Example - "eventCreatedTime": "2020-02-03T00:00:00.000Z"
Thank you