@zeropress/preview-data-validator 0.1.0 → 0.1.1
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.
- package/README.md +4 -0
- package/package.json +1 -1
- package/src/index.js +4 -4
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @zeropress/preview-data-validator
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
3
7
|
Shared validation core for ZeroPress preview data v0.2.
|
|
4
8
|
|
|
5
9
|
This package is the canonical runtime contract for preview payloads consumed by:
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -269,10 +269,10 @@ function isOptionalKey(path, key) {
|
|
|
269
269
|
if (path === 'site') return key === 'logo' || key === 'social';
|
|
270
270
|
if (path.endsWith('.index')) return false;
|
|
271
271
|
if (path.endsWith('.archive')) return key === 'categories' || key === 'tags';
|
|
272
|
-
if (path.
|
|
273
|
-
if (path.
|
|
274
|
-
if (path.
|
|
275
|
-
if (path.
|
|
272
|
+
if (path.startsWith('routes.categories[')) return key === 'categories';
|
|
273
|
+
if (path.startsWith('routes.tags[')) return key === 'tags';
|
|
274
|
+
if (path.startsWith('content.posts[')) return key === 'author_avatar' || key === 'featured_image';
|
|
275
|
+
if (path.startsWith('content.categories[')) return key === 'description';
|
|
276
276
|
return false;
|
|
277
277
|
}
|
|
278
278
|
|