cube-js / cube-js/cube

Playground REST API tab should display array format for order parameter

Open
#10,328 3 comments 1 reaction 0 assignees View on GitHub
client:playground help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

## Description

The Playground's **REST API** tab displays the `order` parameter as an object:

```json
"order": {
"orders.raw_customers_last_name": "asc",
"orders.raw_customers_first_name": "desc"
}
```

However, Cube's own documentation recommends the [alternative order format](https://cube.dev/docs/product/apis-integrations/rest-api/query-format#alternative-order-format) (array) for reliable multi-column ordering:

```json
"order": [
["orders.raw_customers_last_name", "asc"],
["orders.raw_customers_first_name", "desc"]
]
```

## Why this matters

1. **JSON object key order is not guaranteed** by RFC 7159. While modern JS engines preserve insertion order, this is implementation-dependent and can break across different languages, parsers, or environments.

2. **The REST API tab's purpose is to provide copyable examples** for integrators. Showing the object format sets developers up for subtle ordering bugs when they copy it into their applications.

3. **Consistency**: Issue #7217 already requests that Vue's query builder use the array format. The Playground's REST API tab should follow the same principle.

## Expected behavior

The REST API tab should display the array format that Cube recommends in its documentation, so integrators copy the reliable format.

## Related

- #7217 - Vue's query builder should use alternative order format
- #773 / PR #973 - Original work to support ordered `order` specification

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.