v0.136.2

Released Nov 27th 2018

Upgrade the Command Line Interface (CLI) with

npm install --global @sanity/cli

Upgrade the Content Studio with:

sanity upgrade

✨ Highlights

Hide original filenames

When uploading files and images, the original filenames are persisted by default. If the filenames can contain sensitive information, you can now opt out of this behavior by setting the storeOriginalFilename option to false. See the file or image documentation for more info.

Specify field validation overrides

In certain cases, you may have defined a top-level object type that you are reusing for multiple fields. Previously there was no way to set validation rules on fields within the object based on the parent field it was being used in.

In this release, we've added a feature that allows you to call Rule.fields() with an object, where the keys represent the field name and the values being the field-level validation to apply.

For instance:

{
  name: 'title',
  title: 'Title',
  type: 'localizedString',
  validation => Rule.fields({
    en: fieldRule => fieldRule.required(),
    nb: fieldRule => fieldRule.min(5).max(200)
  })
}

Note that this will override the validation rules set on the parent types fields (localizedString in the above example).

🐛 Notable bugfixes

  • Fixed bug where @sanity/client could not be used in React Native environments
  • Removed root-prefix for results in Vision tool

📓 Full changelog

AuthorMessageCommit
Espen Hovlandsdalvalidation Allow specifying field validation overrides for top-level objects (#1030)ed68970b9
Espen Hovlandsdalvalidation Fix incorrect call signature of inferFromSchemaType76407102d
Espen Hovlandsdalbase Hoist unnamed object types (#1033)ef37acf20
Espen Hovlandsdalcolor-input Hoist color types, add _type to objects (#1036)748b6f8b5
Espen Hovlandsdalcolor-input Update readme to reflect latest changes3071dbfb4
Espen Hovlandsdalschema Fix media field inference crash for certain types (#1037)1f29d69a5
Dan Rosenshainvision Fix bug in vision plugin not remembering last used dataset (#1050)d44c699c9
Espen Hovlandsdalclient Check for presence of window.location to determine if browser env (#1054)87a212181
Espen Hovlandsdalvision Remove "root"-prefix in results (#1055)cef26b20d
Espen Hovlandsdalform-builder Add ability to disable original filename for assets (#1056)1d02c2cc8
Bjørge Næssdefault-layout Only select _id and _type when searching (#1057)c7271c67f
Espen Hovlandsdalstructure Add @types/node for proper node.js typings (#1058)2a74e9ea9