box / box/ClusterRunner

Console output API does not match style of other APIs

Open
#282 2 comments 0 reactions 1 assignee Claimed by @nickzuber View on GitHub
enhancement minor question
Dominant language
Python
Stars
184
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Here's an example of the console output API response:

``` json
GET "/v1/build/1/subjob/0/atom/0/console"
{
"total_num_lines": 1,
"child_routes": {},
"content": "hello dummy\n",
"offset_line": 0,
"num_lines": 1
}
```

Note that the "child_routes" entry is combined with the resource data. The pattern set by all the other APIs is to nest the resource data one level deeper. The main benefit of this is that response metadata ("child_routes" is the only example of this right now) can be separated from the data of the requested resource.

Examples of other API responses that show the proper pattern:

``` json
GET "/v1/build/1/subjob/0/atom/0"
{
"atom": {
"subjob_id": 0,
"id": 0,
"exit_code": 0,
"expected_time": 0.01,
"command_string": "export ATOM=\"hai\";",
"state": "COMPLETED",
"actual_time": 0.03
},
"child_routes": {
"console": "/v1/build/[build_id]/subjob/[subjob_id]/atom/[atom_id]/console"
}
}
```

``` json
GET "/v1/slave/0"
{
"slave": {
"url": "jharrington.local:43001",
"num_executors_in_use": 0,
"is_in_shutdown_mode": false,
"current_build_id": null,
"id": 1,
"num_executors": 1,
"is_alive": true
},
"child_routes": {
"shutdown": "/v1/slave/[slave_id]/shutdown"
}
}
```

This would be an easy change to make if we ignored backwards compatibility, but since we haven't yet done any API versioning there will be some overhead in fixing this the right way.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.