Skip to content

Instantly share code, notes, and snippets.

@dorelljames
Forked from bjoerge/recover-schema.md
Created March 14, 2023 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dorelljames/512ccb19f8970372af13500b2efc714a to your computer and use it in GitHub Desktop.
Save dorelljames/512ccb19f8970372af13500b2efc714a 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