sanity-advanced-validators 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +2 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # Sanity Advanced Validators
2
2
 
3
- (note: this is a WIP, I don’t know a lot about publishing NPM packages, hopefully coming soon)
4
-
5
3
  This package includes a set of Sanity validators for aggressive and weird edge cases. Please let me know if you find these helpful!
6
4
 
7
5
  Note that every validator can accept an optional custom error message as its last parameter. `minDimensions` lists one example; all the others work the same way.
@@ -35,7 +33,7 @@ const Page = defineType({
35
33
  name: "someVideoFile",
36
34
  type: "file",
37
35
  validation: (rule) =>
38
- rule.requiredIfSlugEq('about')
36
+ rule.custom(requiredIfSlugEq('about'))
39
37
  .custom(fileExtension(['mp4', 'mov']))
40
38
  })
41
39
  defineField({
@@ -43,7 +41,7 @@ const Page = defineType({
43
41
  type: "image",
44
42
  hidden: ({ parent }) => parent.someVideoFile === null,
45
43
  validation: (rule) =>
46
- rule.requiredIfPeerNeq('someVideoFile', null)
44
+ rule.custom(requiredIfPeerNeq('someVideoFile', null))
47
45
  .custom(minDimensions({ x: 1250, y: 800 }))
48
46
  .custom(maxDimensions({ x: 2500, y: 1600 })),
49
47
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package-name": "sanity-advanced-validators",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Advanced input validation tools for Sanity CMS.",
5
5
  "author": "Eric_WVGG",
6
6
  "license": "MIT",