Zuora Documentation

Re: Java SDK

Hi rahulaga,

 

I hear what you're saying - I can understand why you wouldn't want to modify the autogenerated code.

 

I've just done some further investigation on this and I found that it's possible to modify the Swagger spec so that swagger-codegen inserts HashMap<String, Object> in ZObject.java; no need to manually modify the autogenerated code.

 

However, the Swagger change would be a workaround that would misrepresent our API (and could easily cause issues elsewhere) so I'm reluctant to make that change in our offical Swagger spec. But you would of course be free to modify your copy of the Swagger spec, and the necessary modification is very suitable to be scripted.

 

Here's what your script would need to do:

 

  1. Load our Swagger spec using a YAML parser, so that you can manipulate the spec as a native object.
  2. Set definitions.zObject to this object:
    {
      "type": "object"
      "additionalProperties": {
        "type": "object"
      }
    }
    Note that I'm using JavaScript notation for this example.
  3. Output the modified spec in JSON format.
  4. Feed the JSON file to swagger-codegen.

Is this process something that you'd be able to include in your workflow?