@bedrockio/model 0.20.1 → 0.20.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.20.2
2
+
3
+ - Fixed `_id: false` on validation schemas.
4
+
1
5
  ## 0.20.1
2
6
 
3
7
  - Fixed `_id: false` on array fields.
@@ -194,6 +194,11 @@ function getObjectSchema(arg, options) {
194
194
  } = options;
195
195
  const map = {};
196
196
  for (let [key, field] of Object.entries(arg)) {
197
+ if (key === '_id' && field === false) {
198
+ // This is a special case in Mongoose that allows disabling
199
+ // the _id field for array objects so skip it here.
200
+ continue;
201
+ }
197
202
  if (!isExcludedField(field, options)) {
198
203
  map[key] = getNestedSchema(field, options);
199
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/model",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
4
4
  "description": "Bedrock utilities for model creation.",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/validation.js CHANGED
@@ -209,6 +209,11 @@ function getObjectSchema(arg, options) {
209
209
  const map = {};
210
210
 
211
211
  for (let [key, field] of Object.entries(arg)) {
212
+ if (key === '_id' && field === false) {
213
+ // This is a special case in Mongoose that allows disabling
214
+ // the _id field for array objects so skip it here.
215
+ continue;
216
+ }
212
217
  if (!isExcludedField(field, options)) {
213
218
  map[key] = getNestedSchema(field, options);
214
219
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/validation.js"],"names":[],"mappings":"AA6DA,kDAEC;AAED,oEA4FC;AAsBD,wEAiBC;AAmUD;;;EAEC;AAED;;;EAOC"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/validation.js"],"names":[],"mappings":"AA6DA,kDAEC;AAED,oEA4FC;AAsBD,wEAiBC;AAwUD;;;EAEC;AAED;;;EAOC"}