cube icon indicating copy to clipboard operation
cube copied to clipboard

Format does not return on the REST API when querying a view

Open Barnyclark opened this issue 3 years ago • 4 comments

Describe the bug If you add the format field to a metric on a cube and then include that metric in a view, the format field is not returned in the API /meta or /query response for the view. Format is included in for the metric on the cube - just not the view.

To Reproduce Steps to reproduce the behaviour:

  1. Create a cube with one or more metrics
  2. Add format: currency or format: percent to the metrics
  3. Create a view that includes the metrics in 1)
  4. Make a request to the /meta or /query endpoints on the REST API.
  5. You will see the format field is returned for the cube but not the view.

Expected behaviour I would expect the format field to be included in the annotations object of the /query response if I query the view. Otherwise, it is not possible to apply the format on the client.

Additional context Both description and meta fields are carried through to the view response from the underlying cube.

Barnyclark avatar Nov 21 '23 18:11 Barnyclark

@Barnyclark Thanks for reporting this! I think this is related to #7475.

igorlukanin avatar Nov 30 '23 13:11 igorlukanin

If you are interested in working on this issue, please leave a comment below and we will be happy to assign the issue to you. If this is the first time you are contributing a Pull Request to Cube.js, please check our contribution guidelines. You can also post any questions while contributing in the #contributors channel in the Cube.js Slack.

github-actions[bot] avatar Nov 30 '23 13:11 github-actions[bot]

Yes, that makes sense. I have noticed it the same with the public field as well.

Barnyclark avatar Dec 07 '23 22:12 Barnyclark

I couldn't reproduce this on Cube v1.8.20. My setup: Cube with Postgres 16 and Cube Store, a cube with measures that have format: currency and format: percent, and a view that includes that cube.

For the view's measures, /v1/meta returns format: "currency" and format: "percent", and a /v1/load query on the view returns format in the annotation too.

I'm closing this because it doesn't reproduce. If you still see it on a recent version, please open a new issue with your cube and view definitions.


Generated by Claude Code

paveltiunov avatar Nov 06 '26 16:11 paveltiunov