From Claimcenter Claim Cloud API, I can get the JSON SCHEMA for Claim Graph. I would like to convert the Claim Graph schema to POJO classes to be used in IG apps. Is there any easy way to generate?
I used the jsonschema2pojo gradle plugin) (https://github.com/joelittlejohn/jsonschema2pojo/tree/master/jsonschema2pojo-gradle-plugin but not seeing the expected result. when i use the sourceType as 'jsonschema' then i don't see any files getting generated but when i use the sourceType as 'json' then it is creating multiple duplicate classes with _.
are there any other tools to convert the Guidewire schema to POJO classes? Screen Shot of Duplicate Classes
I've used openAPI for this purpose in the past in IG apps which want to consume IS APIs. There's some nonstandard tags which end up in the openAPI docs generated by IS apps which require some manual tweaks. Let me document them here for you.
To install the OpenAPI code generator, these instructions were followed: https://openapi-generator.tech/docs/installation/
If the default generator commands are used, GSON will be used, which is not supported in Guidewire Cloud. To use Jackson instead, the following commands were run.
1)When using the openapi file (i.e. http://localhost:8180/pc/rest/job/v1/openapi.json), POJOs attributes which are date datatypes are built with a datatype of JsonNullable. Meanwhile, the methods that deserialize and serialize them are built using simple LocalDate. This presents an error at compile time. All instances had to be manually fixed.
2)The default ObjectMapper instance was serializing non-consumable payloads. It was including all null attributes, and adding in an attribute named "present" with a value of false for all nulls. It was also including all null arrays. Finally, it was serializing dates to a very long structured format. To address these issues, a custom ObjectMapper was initialized and used for all serializations.
The custom object mapper was built as such: