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

feat(core): add --api-version flag for documents query command #2759

Merged
merged 2 commits into from
Sep 10, 2021

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Sep 9, 2021

Description

Adds a --api-version flag to the sanity documents query command that... allows you to specify the API version to use!

For now we'll default to v1 as before so as not to break any potential workflows depending on this command, but in the future (in an upcoming breaking version change) we might force the user to specify an API version either as a flag or as a stored CLI configuration somewhere.

If you don't specify the API version, we'll warn (to stderr):

➜ blog-studio ✗ sanity documents query '*[0]{_id}'
--api-version not specified, using `v1`
{
  "_id": "08353495-d4c9-43fc-8ea1-71e502a626fb"
}

➜ blog-studio ✗ sanity documents query '*[0]{"text": pt::text(body)}' --apiVersion=2021-03-25
{
  "text": "Nana"
}

Also expanded on the CLI typings slightly, adding the things needed for this CLI command. Gradual transition for the win?

What to review

  • That the command works as expected
  • That you agree on the change

To test, you'll have to install dependencies and run npm run build, then execute the command inside one of the example studios.

Notes for release

  • Added --api-version flag to the sanity documents query command

@vercel
Copy link

vercel bot commented Sep 9, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

perf-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/perf-studio/D2gCaAmNhdX3BcFNd13yScX7xCsF
✅ Preview: https://perf-studio-git-feat-cli-query-api-version-flag.sanity.build

test-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/test-studio/8VtfHpEwiUzEHv4RvGNzaob5f2JL
✅ Preview: https://test-studio-git-feat-cli-query-api-version-flag.sanity.build

Copy link
Member

@skogsmaskin skogsmaskin left a comment

Choose a reason for hiding this comment

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

I approve of this change (the option).

@rexxars rexxars merged commit 955c704 into next Sep 10, 2021
@rexxars rexxars deleted the feat/cli-query-api-version-flag branch September 10, 2021 08:53
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.

2 participants