Zuora Documentation

Re: Java SDK

Hi rahulaga, thanks for clarifying.

 

I see what you mean about all the parameters. I think you can set parameters to null if you don't want to use them. But still, that is quite inconvenient. This at least seems to be a known problem with swagger-codegen: https://stackoverflow.com/questions/43044439.

 

I've done some more investigation into the issue you're seeing with zObject. The problem here is that what we've called zObject in our Swagger spec does not have a fixed set of fields; the names and types of the fields that could be returned in the API response depend on the type of object that you're querying.

 

I don't believe that we can fully capture this behavior in Swagger, other than to specify that zObject has some unnamed fields of unknown type (this is done via an additionalProperties declaration is Swagger). In theory, that would cause the ZObject class in Java to extend HashMap, which would then enable you to access the particular fields of each ZObject instance.

 

Unfortunately, it looks like this functionality is currently missing from swagger-codegen. See here: https://github.com/swagger-api/swagger-codegen/issues/7586. In any case, we'll update our Swagger file to support this functionality from our side, so that we are prepared for when swagger-codegen supports it.

 

For now, my only suggestion is that you manually modify the ZObject class in ZObject.java and insert HashMap<String, Object> in the appropriate place. For comparision, take a look at how the CalloutMergeFields class extends HashMap<String, String>.

 

Please let me know if you have any success with this workaround.