Printing Expanded Schema to Page in Drupal Developer Portal

We are trying to get the expanded schema information from our APIs to print to the method documentation page.

Using JSON.stringify it prints as one long string with no formatting.

W'd like it to be presented as a table.

Any suggestions would be most appreciated, from @Anil Sagar @ Google

or others.

I see the javascript functions that turn other parts of the spec into tables.

Am I right that it is the following section of code (from the .hbr template) that needs to be adapted? Any advice to about what need to be changed would be great. (I'm using the updated .hbr that has been published here in community.apigee.

  var requestParamsSchema = Apigee.APIModel.expandedSchema[Apigee.APIModel.resourceName];
        function extractParametersInfo(obj, reqResParams)
        {
            var k;
            if (obj.hasOwnProperty('properties')) {
                for (k in obj['properties']) {
                    obj['properties'][k].name = k;
                    reqResParams.push(obj['properties'][k]);
                    if (obj['properties'][k].hasOwnProperty('properties')){
                        extractParametersInfo( obj['properties'][k], reqResParams);
                    }
if (obj['properties'][k].hasOwnProperty('items')) {
                    extractParametersInfo( obj['properties'][k]['items'], reqResParams);
                        }
                                    }
            }
        };
        var reqResParams = [];
        extractParametersInfo(requestParamsSchema, reqResParams);
        console.log(reqResParams);


        for (k in reqResParams) {
if (reqResParams[k]['description'] == undefined) {
            reqResParams[k]['description'] = "⏎";
                }
                        jQuery("#request-attributes-table").append("<tr><td>" + reqResParams[k]['name'] + " </td><td>" + reqResParams[k]['type'] + "</td><td>" + reqResParams[k]['description'] + "</td></tr>");
        }

This is what you I see when inspecting element in the Firefox debugger.

Apigee.APIModel.expandedSchema={"regional_centers":{
  "type" : "object",
  "properties" : {
    "site_name" : {
      "type" : "string",
      "description" : "Business name of site"
    },
    "district" : {
      "type" : "string",
      "description" : "Global Unique identifier of District coming from ABC or DEF systems"
    },
    "district_name" : {
      "type" : "string",
      "description" : "Business name of District"
    },
    "region" : {
      "type" : "string",
      "description" : "Global Unique identifier of Region coming from MDG or BIC systems"
    }
  }
}};
0 0 97
0 REPLIES 0