Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
✨ Highlights
API versioning support in client and studio
On Thursday, March 25th, we will start versioning our APIs to provide you with great new functionality. The details on the new features will be announced at the Content is Data event on March 25th, and in a subsequent blog post.
Your code should continue to work as before, but we now recommend you specify which API version you want to use when instantiating a new Sanity client:
Using @sanity/client
import SanityClient from '@sanity/client'
const client = new SanityClient({
apiVersion: '2021-03-20',
projectId: '...',
dataset: '...',
useCdn: true,
})
The documentation has more information on the API versioning scheme used in Sanity.
Using the "global" studio client
If you are currently importing from part:@sanity/base/client
in your Sanity studio, plugins or similar, you should now specify which API version to use:
// Before:
import client from 'part:@sanity/base/client'
client.fetch('*[...]')
// After:
import sanityClient from 'part:@sanity/base/client'
const client = sanityClient.withConfig({
apiVersion: '2021-03-20'
})
client.fetch('*[...]')
This enables plugins to work without having to agree on a common API version, as every plugin defines the API version it is known to work with.
Using sanity-php
use Sanity\Client as SanityClient;
$client = new SanityClient([
'apiVersion' => '2021-03-20',
'projectId' => '...',
'dataset' => '...',
'useCdn' => true,
]);
Other clients and libraries
Over the coming days and weeks, we'll be adding API versioning to all our official tooling and libaries, and hope to see community plugins and clients embrace and use the new API versioning functionality!
Other features
- The
altText
was added to the image and file asset types - deploying a new version of your GraphQL API will now let you specify the field when fetching data
🐛 Notable bugfixes
- Fixes an issue where the slug input would not work inside of arrays, and would not broadcast the presence status of someone editing the field
📓 Full changelog
Author | Message | Commit |
---|---|---|
Espen Hovlandsdal | feat(base): add altText field to asset types
| 7f9cf6d |
Bjørge Næss | chore(base): fix lint errors | 307f8c5 |
Espen Hovlandsdal | feat(client): add API versioning support | 47db879 |
Espen Hovlandsdal | feat(base): deprecate studio client without a specified apiVersion | 75318d1 |
Espen Hovlandsdal | feat(client): use api-versioned client throughout internal packages | aef1eb6 |
Espen Hovlandsdal | fix(vision): format non-object return values correctly | f8864cd |
Espen Hovlandsdal | fix(vision): show executed query on empty result, not current query | e45f221 |
Espen Hovlandsdal | feat(vision): support selection of API version | a8f14d8 |
Espen Hovlandsdal | chore(deps): use latest @sanity/client in monorepo | 4941cf0 |
Espen Hovlandsdal | fix(client): correct response type for observable asset uploads | 74fbbaa |
Espen Hovlandsdal | fix(form-builder): point slug focus to current field | 5b15898 |