nextcloud/neon

Invalid tables spec causes deserialization errors in the tables client.

Opened this issue · 0 comments

The tables specs state that the result of a api1.indexTableRowsSimple request returns a List<Strings>

"/index.php/apps/tables/api/1/tables/{tableId}/rows/simple": {
"get": {
"operationId": "api1-index-table-rows-simple",
"summary": "List all rows values for a table, first row are the column titles",
"tags": [
"api1"
],
"security": [
{
"basic_auth": []
}
],
"parameters": [
{
"name": "tableId",
"in": "path",
"description": "Table ID",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
},
{
"name": "limit",
"in": "query",
"description": "Limit",
"schema": {
"type": "integer",
"format": "int64",
"nullable": true
}
},
{
"name": "offset",
"in": "query",
"description": "Offset",
"schema": {
"type": "integer",
"format": "int64",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "Row values returned",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"403": {
"description": "No permissions",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string"
}
}
}
}
}
},
"500": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string"
}
}
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string"
}
}
}
}
}
}
}
}
},

But it actually returns a List<List<String>>:

[
  [
    "What",
    "How to do",
    "Ease of use",
    "Done"
  ],
  [
    "Open the tables app",
    "Click on tables icon in the menu bar.",
    5,
    "true"
  ],
  [
    "Add your first row",
    "Just click on \"new row\" and enter some data inside of the form. At the end click on the bottom \"save\".",
    5,
    "false"
  ],
  [
    "Edit a row",
    "Hover the mouse over a row you want to edit. Click on the pen on the right side. Maybe you want to add a \"done\" status to this row.",
    5,
    "false"
  ],
  [
    "Add a new column",
    "You can add, remove and adjust columns as you need it. Click on the three-dot-menu on the upper right of this table and choose \"create column\". Fill in the data you want, at least a title and column type.",
    4,
    "false"
  ],
  [
    "Read the docs",
    "If you want to go through the documentation, this can be found here: https:\\/\\/github.com\\/nextcloud\\/tables\\/wiki",
    3,
    "false"
  ]
]

I don't think this is an issue in the openapi-extractor, as the typing of the relevant php code is also referring to a string[].
Opening an issue upstream to hopefully get it fixed soon.
https://github.com/nextcloud/tables/blob/5cc780ce4260c262e3b733f5cb9d7959a9262938/lib/Controller/Api1Controller.php#L1032-L1060

We might be able to patch the spec for now, but I'm not sure how many endpoints are affected by this issue.

Upstream issue:
nextcloud/tables#1367