Hi,
We have generated a Java client from the Account API Swagger using OpenAPI Tools.
The Java client successfully generates and compiles but we are having problems calling endpoints that return lists of objects. For example if we call the GET /ledger_accounts endpoint the Java client blows up because the JSON object returned doesn't match what is defined in the Swagger.
The endpoint is documented here as returning an array like this:
[
{
"id": "5135bf0b019049c099cedc1a0771cb3a",
"displayed_as": "Bank Account (1200)",
"$path": "/ledger_accounts/5135bf0b019049c099cedc1a0771cb3a"
},
{
"id": "6f9ff4f0662944379d64e9c544eac6ad",
"displayed_as": "Cash (1210)",
"$path": "/ledger_accounts/6f9ff4f0662944379d64e9c544eac6ad"
}
]
This looks to match what is in the Swagger and the Java client generated from it.
What is actually returned is this:
{
"$total": 124,
"$page": 1,
"$next": "/ledger_accounts?page=2&items_per_page=20",
"$back": null,
"$itemsPerPage": 20,
"$items": [
{
"id": "5135bf0b019049c099cedc1a0771cb3a",
"displayed_as": "Bank Account (1200)",
"$path": "/ledger_accounts/5135bf0b019049c099cedc1a0771cb3a"
},
{
"id": "6f9ff4f0662944379d64e9c544eac6ad",
"displayed_as": "Cash (1210)",
"$path": "/ledger_accounts/6f9ff4f0662944379d64e9c544eac6ad"
}
]
}
The documented array is embedded in a 'page' object. The 'page' object isn't described in the documentation for this endpoint or the Swagger file.
I suppose the question I have is, are we maybe not supposed to use the Swagger to generate clients i.e. it is only for documentation purposes?