Response type not well formatted as expected


#1

I have a remote web service that point to mongodb http service on port 28017, i choose this typeof service instead of using the default mongo database service as i would like to manage on the same time different databases. but with this solution i have the definition:

{
“paths” : {
"/listDatabases" : {
“get” : {
“tags” : [ “ia” ],
“summary” : “getIaResources() - Get resources for this service.”,
“description” : “Return an array of the resources available.”,
“operationId” : “getIaResources”,
“responses” : {
“200” : {
“description” : “Success”,
“schema” : {
"$ref" : “#/definitions/SchemasResponse”
}
},
“default” : {
“description” : “Error”,
“schema” : {
"$ref" : “#/definitions/Error”
}
}
}
}
},
"/{alias}/{table_name}/index" : {
“parameters” :
[
{
“name” : “alias”,
“in” : “path”,
“description” : “alias of the database to connect on.”,
“required” : true,
“type” : “string”
} ,
{
“name” : “table_name”,
“in” : “path”,
“description” : “Table name”,
“required” : true,
“type” : “string”
}
],
“get” : {
“tags” : [ “iaSchema” ],
“summary” : " () - List all table names",
“description” : “Return a list of the resource identifiers.”,
“operationId” : “getIaSchema”,
“responses” : {
“200” : {
“description” : “Success”,
“schema” : {
"$ref" : “#/definitions/NamespacesResponse”
}
},
“default” : {
“description” : “Error”,
“schema” : {
"$ref" : “#/definitions/Error”
}
}
}
}
}
“get” : {
“tags” : [ “iaIds” ],
“summary” : “getIaRecord() - Retrieve one record by identifier.”,
“description” : “Use the fields parameter to limit properties that are returned. By default, all fields are returned.”,
“operationId” : “getIaRecord”,
“consumes” : [ “application/json”, “application/xml”, “text/csv” ],
“produces” : [ “application/json”, “application/xml”, “text/csv” ],
“parameters” : [ {
“name” : “id”,
“in” : “path”,
“description” : “Identifier of the record to retrieve.”,
“required” : true,
“type” : “string”
}, {
“name” : “table_name”,
“in” : “path”,
“description” : “Name of the table to perform operations on.”,
“required” : true,
“type” : “string”
}, {
“name” : “alias”,
“in” : “path”,
“description” : “alias of the database to connect on.”,
“required” : true,
“type” : “string”
}, {
“name” : “fields”,
“in” : “query”,
“description” : “Comma-delimited list of properties to be returned for each resource, “*” returns all properties. If as_list, use this to override the default identifier.”,
“required” : false,
“type” : “array”,
“items” : {
“type” : “string”
},
“collectionFormat” : “csv”
}, {
“name”: “filter”,
“type”: “string”,
“in”: “path”,
“description”: “SQL-like filter to limit the records to retrieve.”
},{
“name”: “limit”,
“type”: “integer”,
“format”: “int32”,
“in”: “query”,
“description”: “Set to limit the filter results.”
},{
“name”: “offset”,
“type”: “integer”,
“format”: “int32”,
“in”: “query”,
“description”: “Set to offset the filter results to a particular record count.”
},
{
“name”: “order”,
“type”: “string”,
“in”: “query”,
“description”: “SQL-like order containing field and direction for filter results.”
},{
“name” : “id_field”,
“in” : “query”,
“description” : “Comma-delimited list of the fields used as identifiers, used to override defaults or provide identifiers when none are provisioned.”,
“required” : false,
“type” : “array”,
“items” : {
“type” : “string”
},
“collectionFormat” : “csv”
}, {
“name” : “id_type”,
“in” : “query”,
“description” : “Comma-delimited list of the field types used as identifiers for the table, used to override defaults or provide identifiers when none are provisioned.”,
“required” : false,
“type” : “array”,
“items” : {
“type” : “string”
},
“collectionFormat” : “csv”
} ],
“responses” : {
“200” : {
“description” : “Record”,
“schema” : {
"$ref" : “#/definitions/RecordResponse”
}
},
“default” : {
“description” : “Error”,
“schema” : {
"$ref" : “#/definitions/Error”
}
}
}
}
}
},
“definitions” : {

  "type" : "object",
  "properties" : {
    "resource" : {
      "type" : "array",
      "description" : "Array of accessible resources available to this path.",
      "items" : {
        "type" : "string"
      }
    }
  }
},
"SystemResponse" : {
  "type" : "object",
  "properties" : {
    "name" : {
      "type" : "string",
      "description" : "Identifier of the resource."
    }
  }
},
"NamespacesResponse" : {
  "type" : "object",
  "properties" : {
	"offset" : {
       "type": "integer",
	   "format": "int32",
      "description" : "Identifier of the resource."
    },
	"rows":{
	  "type" : "array",
      "description" : "Array of resources available to this path.",
      "items" : {
         "$ref" : "#/definitions/SystemResponse"
      }
	},
	"total_rows" : {
       "type": "integer",
	   "format": "int32",
      "description" : "total of the resource."
    }
  }
},

"SchemaResponse" : {
  "type" : "object",
  "properties" : {
    "name" : {
      "type" : "string",
      "description" : "Identifier of the resource."
    }
  }
},
"SchemasResponse" : {
  "type" : "object",
  "properties" : {
    "databases" : {
      "type" : "array",
      "description" : "Array of resources available to this path.",
      "items" : {
        "$ref" : "#/definitions/SchemaResponse"
      }
    }
  }
},
"Error" : {
  "type" : "object",
  "properties" : {
    "code" : {
      "type" : "integer",
      "format" : "int32"
    },
    "message" : {
      "type" : "string"
    },
    "context" : {
      "type" : "string"
    }
  }
}

}
}

This generate a string response on using api_docs when calling the service with the url:http://127.0.0.1/api/v2/httpmongo/ALMia2_spring_2017/tests/index i get the response content as string instead of json format like this:
"{\n “offset” : 0,\n “rows”: [\n
{ “_id” : { “$oid” : “5846b5240a0e1a2ac0b6dca9” }, “application_name” : “2D”, “docs” : [ “DOC1”, “DOC2” ] } ,\n
{ “_id” : { “$oid” : “5846b5240a0e1a2ac0b6dcaa” }, “application_name” : “4D”, “docs” : [ “4D DOC1”, “4D DOC2” ] } ,\n
{ “_id” : { “$oid” : “5846b5240a0e1a2ac0b6dcab” }, “application_name” : “appli2”, “docs” : null } ,\n
{ “_id” : { “$oid” : “5846b5240a0e1a2ac0b6dcac” }, “application_name” : “appli3”, “docs” : null } ,\n
{ “_id” : { “$oid” : “5846b5240a0e1a2ac0b6dcad” }, “application_name” : “appli4”, “docs” : [ “DOC1” ] } ,\n
{ “_id” : { “$oid” : “5846b5240a0e1a2ac0b6dcae” }, “application_name” : “appli5”, “docs” : [ “DOC2” } ,\n
"total_rows" : 6 ,\n “query” : {} ,\n “millis” : 0\n}\n"

I try to transform response to json on post processing script but i don’t see anything on script page when selecting the remote service.

How can i handle this web service with json format reponse? any error on configuration service swagger definition?

I don’t have any idea how this could be resolved or it’s a bug,i don’t have much example on remote service.