@bedrockio/model 0.22.3 → 0.22.4

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.22.4
2
+
3
+ - Yada bump and ensure GeoJSON validators are respected.
4
+
1
5
  ## 0.22.3
2
6
 
3
7
  - Package bump
@@ -262,6 +262,9 @@ function getSchemaForTypedef(typedef, options = {}) {
262
262
  if ((0, _utils.isMongooseSchema)(type)) {
263
263
  schema = getObjectSchema(type, options);
264
264
  } else if (Array.isArray(type)) {
265
+ if (typedef.validate?.schema) {
266
+ return typedef.validate.schema;
267
+ }
265
268
  schema = getArraySchema(type, options);
266
269
  } else if (typeof type === 'object') {
267
270
  schema = getObjectSchema(type, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/model",
3
- "version": "0.22.3",
3
+ "version": "0.22.4",
4
4
  "description": "Bedrock utilities for model creation.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -40,7 +40,7 @@
40
40
  "@babel/preset-env": "^7.26.0",
41
41
  "@bedrockio/eslint-plugin": "^1.3.1",
42
42
  "@bedrockio/prettier-config": "^1.1.1",
43
- "@bedrockio/yada": "^1.11.0",
43
+ "@bedrockio/yada": "^1.11.2",
44
44
  "@shelf/jest-mongodb": "^5.2.2",
45
45
  "eslint": "^9.36.0",
46
46
  "jest": "^30.2.0",
package/src/validation.js CHANGED
@@ -214,6 +214,7 @@ function getObjectSchema(arg, options) {
214
214
  // the _id field for array objects so skip it here.
215
215
  continue;
216
216
  }
217
+
217
218
  if (!isExcludedField(field, options)) {
218
219
  map[key] = getNestedSchema(field, options);
219
220
  }
@@ -287,6 +288,9 @@ function getSchemaForTypedef(typedef, options = {}) {
287
288
  if (isMongooseSchema(type)) {
288
289
  schema = getObjectSchema(type, options);
289
290
  } else if (Array.isArray(type)) {
291
+ if (typedef.validate?.schema) {
292
+ return typedef.validate.schema;
293
+ }
290
294
  schema = getArraySchema(type, options);
291
295
  } else if (typeof type === 'object') {
292
296
  schema = getObjectSchema(type, options);
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/validation.js"],"names":[],"mappings":"AA6DA,kDAEC;AAED,oEA4FC;AAsBD,wEAiBC;AAwUD;;;EAEC;AAED;;;EAOC"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/validation.js"],"names":[],"mappings":"AA6DA,kDAEC;AAED,oEA4FC;AAsBD,wEAiBC;AA4UD;;;EAEC;AAED;;;EAOC"}