Configure Studio
New openapi CLI command, Media Library filters in Studio, and additional fixes
v4.2.0
New sanity openapi command
New sanity openapi command group with list and get subcommands for accessing Sanity OpenAPI specifications directly from the CLI.
Command overview:
usage: npx sanity openapi [--default] [-v|--version] [-d|--debug] [-h|--help] <command> [<args>] Commands: get Get a specific OpenAPI spec by slug list List all available OpenAPI specifications See 'npx sanity help openapi <command>' for specific information on a subcommand.
Usage examples:
List all available OpenAPI specssanity openapi list
List with JSON output for scriptingsanity openapi list --json
Open HTTP Reference in browsersanity openapi list --web
Get a specific spec (YAML format, default)sanity openapi get query
Get spec in JSON formatsanity openapi get query --format=json
Open specific spec in browsersanity openapi get query --web
Pipe to filesanity openapi get query > query-api.yamlsanity openapi get assets --format=json > assets-api.json
Key features:
- 20 available OpenAPI specs at time of release: Access API, Actions, Agent Actions, Assets API, Backups, Copy API, Doc API, Embeddings Index, Export, History, Jobs, Listen, Live, Media Library API, Mutation, Projects, Query, Roles, Scheduling, Webhooks
- Clean piping: Status messages respect
isInteractiveto avoid contaminating redirected output - Web integration: Seamless browser opening for traditional documentation browsing
- Automation-friendly: JSON output and clean piping support scripting workflows
Filter support for Media Library asset selection
You can now add filters to image and file types to limit which Media Library assets display in the image selection interface.
This lets you specify GROQ filters that apply to the Media Library's sanity.imageAsset and sanity.fileAsset documents.
Example:
{
name: 'imageWithMediaLibraryFilters',
title: 'Image with Media Library filter',
type: 'image',
options: {
mediaLibrary: {
filters: [
{
name: 'Has colourDetails aspect',
query: 'defined(aspects.colourDetails)',
},
{
name: 'Greater than 4000px wide',
query: 'currentVersion->metadata.dimensions.width > 4000',
},
],
},
},
}Fix for empty dialogs
A recent release of a rollup, which is a library used by sanity build caused dialogs in the Studio to be rendered with height of 1 pixel, effectively rendering all dialogs empty. This issue should no longer appear in newly created studios as of v4.2.0, but it might require intervention for existing Studios affected by this issue.
If you still see this issue after upgrading to sanity@v4.2.0, running one of the following commands (depending on your package manager) should fix the issue for now:
npm install --no-save rollup@4.45.3 # or pnpm up rollup@4.45.3 # or yarn upgrade --no-save rollup@4.45.3
pnpm add --no-save rollup@4.45.3 # or pnpm up rollup@4.45.3 # or yarn upgrade --no-save rollup@4.45.3
yarn add rollup@4.45.3 # or pnpm up rollup@4.45.3 # or yarn upgrade --no-save rollup@4.45.3
bun add rollup@4.45.3 # or pnpm up rollup@4.45.3 # or yarn upgrade --no-save rollup@4.45.3
Additional bugfixes and improvements
- TypeGen: Fixes a bug with references declared as inline types.
npx sanity initinnextprojects now usenext-sanity@v10, which supportssanity@v4and hasnext@v15.1andreact@v19as its baseline.- Fixes an issue where the title for a draft document with a task wasn't showing up when opening the task list view.
- Adds visual improvements to the Studio version info dialog.