'Super Basic Sanity Schema Import
I need some help importing schemas from Visual Studio Code into the Sanity console. I'm importing everything as usual and when Content Studio is successfully compiled I'm still not seeing anything in the Studio
I see Empty Schema every single time. Anyone know how to fix this?
one example of a schema im trying to import
export default{
name:'abouts',
title:'Abouts',
type: 'document',
fields:[
{
name:'title',
title:'Title',
type:'string'
},
{
name:'description',
title:'Description',
type:'string'
},
{
name:'imgUrl',
title:'ImgUrl',
type: 'image',
options: {
hotspot: true,
},
},
]
}
all my types are document
here is the schema.js
// First, we must import the schema creator
import createSchema from 'part:@sanity/base/schema-creator'
// Then import schema types from any plugins that might expose them
import schemaTypes from 'all:part:@sanity/base/schema-type'
import testimonials from './testimonials'
import about from './about'
// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
// We name our schema
name: 'default',
// Then proceed to concatenate our document type
// to the ones provided by any plugins that are installed
types: schemaTypes.concat([
testimonials,
about
]),
})
I know its super simple but I'm trying to really dig in and get a portfolio started. Thanks so much in advance!
Solution 1:[1]
Your schema is named abouts, but you import about in the schema.js-file. The names must match.
Solution 2:[2]
as stated above, make sure the names are exact. also under types: schemaTypes.concat([
make sure each type has a comma after EVERY one, or it wont render it.
hope this helps. 45 min of digging around and testing and this is what fixed it.
so it should look like this: types: schemaTypes.concat([ about, testimonials, brands, ect....
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jtveter |
| Solution 2 | Sean Bray |
