Skip to content

Instantly share code, notes, and snippets.

@pierrenel
Forked from bjoerge/recover-schema.md
Created May 24, 2023 16:51
Show Gist options
  • Save pierrenel/a02b5fc235b77a95bf0bfcef4f329596 to your computer and use it in GitHub Desktop.
Save pierrenel/a02b5fc235b77a95bf0bfcef4f329596 to your computer and use it in GitHub Desktop.
How to recover lost schema from *.sanity.studio.md

First, go to https://<yourname>.sanity.studio (or to the url of your studio if it's hosted elsewhere). Then open the developer console (usually by one of the keyboard shortcuts Command+Option+I, F12 or Control+Shift+I depending on what browser/platform you are using)

Steps

  1. Open the Sources tab
  2. Find the app.bundle.js file in the sidebar tree view.
  3. Hit the pretty print source button
  4. Locate your schema types by searching (e.g. try searching for one of your custom types) it in the source view.

You should be able to recover most of your schema type definitions this way, although you may need to reformat and rewrite from the minified code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment