Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify --raw flag help #516

Merged
merged 2 commits into from
Dec 12, 2024
Merged

Clarify --raw flag help #516

merged 2 commits into from
Dec 12, 2024

Conversation

jrodewig
Copy link
Contributor

@jrodewig jrodewig commented Dec 12, 2024

Ticket(s): FE-6234

Problem

The current --raw and .toggleRawResponses help text mentions the API response. This is misleading as the response actually comes from the JS driver.

Solution

Rewords the text to avoid mentioning "full API response".

Result

Meh...? We could mention the JS driver here, but I think that gets very implementation-detail-y. This is mostly helpful for folks looking for query stats.

Testing

N/A

@jrodewig jrodewig requested a review from a team as a code owner December 12, 2024 17:43
@ptpaterson
Copy link
Contributor

ptpaterson commented Dec 12, 2024

The "simple" format is what is returned from the API and displayed without additional processing. I don't think it is inaccurate to say API response body.

@jrodewig
Copy link
Contributor Author

jrodewig commented Dec 12, 2024

The "simple" format is what is returned from the API and displayed without additional processing. I don't think it is inaccurate to say API response body.

I don't think it's related to data format. We omit stuff like the error obj and schema_version (because it's omitted in the JS driver). The shape is also slightly different.

For example, if you run the invalid query Time. with fauna query --raw:

{
  "httpStatus": 400,
  "code": "invalid_query",
  "queryInfo": {
    "txn_ts": 1734032472313204,
    "summary": "error: Expected identifier\nat *query*:1:6\n  |\n1 | Time.\n  |      ^\n  |",
    "stats": {
      "compute_ops": 1,
      "read_ops": 0,
      "write_ops": 0,
      "query_time_ms": 36,
      "contention_retries": 0,
      "storage_bytes_read": 0,
      "storage_bytes_write": 0,
      "rate_limits_hit": []
    }
  },
  "name": "QueryCheckError"
}

In the HTTP API, the JSON response is:

{
  "error": {
    "code": "invalid_query",
    "message": "The query failed 1 validation check"
  },
  "summary": "error: Expected identifier\nat *query*:1:6\n  |\n1 | Time.\n  |      ^\n  |",
  "txn_ts": 1734032560308032,
  "stats": {
    "compute_ops": 1,
    "read_ops": 0,
    "write_ops": 0,
    "query_time_ms": 1,
    "contention_retries": 0,
    "storage_bytes_read": 0,
    "storage_bytes_write": 0,
    "rate_limits_hit": []
  },
  "schema_version": 1734013351355000
}

Copy link
Contributor

@ptpaterson ptpaterson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay thank you for clarifying. I'm good with this. I am still trying to work out the final behavior of --raw (or whatever it may evolve into).

@jrodewig jrodewig merged commit 8ac0681 into v3 Dec 12, 2024
4 checks passed
@jrodewig jrodewig deleted the clarify-raw-flag branch December 12, 2024 21:19
@cleve-fauna cleve-fauna mentioned this pull request Dec 13, 2024
@wildemat wildemat mentioned this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants