Skip to content

Commit

Permalink
feat(schema): allow objects with initial values
Browse files Browse the repository at this point in the history
  • Loading branch information
juicycleff authored and bjoerge committed Apr 28, 2021
1 parent 63d090e commit 041913b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/@sanity/schema/src/sanity/validation/types/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,13 @@ export default (typeDef, visitorContext) => {
preview = previewErrors.some((err) => err.severity === 'error') ? {} : preview
}

if (typeDef.type !== 'document' && typeof typeDef.initialValue !== 'undefined') {
if (
typeDef.type !== 'document' &&
typeDef.type !== 'object' &&
typeof typeDef.initialValue !== 'undefined'
) {
problems.push(
error(`The "initialValue" property is currently only supported for document types.`)
error(`The "initialValue" property is currently only supported for document & object types.`)
)
}

Expand Down

0 comments on commit 041913b

Please sign in to comment.