Skip to content

Commit 7cb1c35

Browse files
authored
Merge pull request #2 from Aratramba/object-snippet
add object field snippet - courtesy from @Aratramba (thank you 🙌)
2 parents 4bbe385 + 2b300ae commit 7cb1c35

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Every snippets starts with either `sanity(...)` or `groq(...)`, so you know they
2121
- **Sanity Required** (`sanityRequired`): Make a given field required
2222
- **Sanity Array Validation (min & max)** (`sanityArrValidation`): Validate an array field based on its length
2323
- **Sanity Basic Array** (`sanityArrFld`): Create a basic array field in Sanity
24+
- **Sanity Basic Object** (`sanityObjFld`): Create a basic object field in Sanity
2425
- **Sanity Reference Field** (`sanityRefFld`): Create a basic reference field in Sanity
2526
- **GROQ block drafts constraint** (`groqDraftConstraint`): Constraint for groq queries to prevent or limit to drafted documents
2627
- **Component document view** (`sanityViewComponent`): Add a view to a document with a React component

snippets/schema.code-snippets

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,19 @@
112112
"\tto: [{ type: '${3:author}' }],",
113113
"},"
114114
]
115-
}
115+
},
116+
"Sanity Object Field": {
117+
"description": "Create a basic object field in Sanity",
118+
"prefix": "sanityObjFld",
119+
"body": [
120+
"{",
121+
"\tname: '${1:name}',",
122+
"\ttitle: '${2:title}',",
123+
"\ttype: 'object',",
124+
"\tfields: [",
125+
"\t\t$3",
126+
"\t],",
127+
"},"
128+
]
129+
},
116130
}

0 commit comments

Comments
 (0)