@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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # @zeropress/preview-data-validator
2
2
 
3
+ ![npm](https://img.shields.io/npm/v/%40zeropress%2Fpreview-data-validator)
4
+ ![license](https://img.shields.io/npm/l/%40zeropress%2Fpreview-data-validator)
5
+ ![node](https://img.shields.io/node/v/%40zeropress%2Fpreview-data-validator)
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeropress/preview-data-validator",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Shared ZeroPress preview data validation core",
5
5
  "type": "module",
6
6
  "license": "MIT",
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.includes('categories[')) return key === 'categories';
273
- if (path.includes('tags[')) return key === 'tags';
274
- if (path.includes('.posts[')) return key === 'author_avatar' || key === 'featured_image';
275
- if (path.includes('.categories[')) return key === 'description';
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