@bedrockio/model 0.1.28 → 0.1.29

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.
@@ -270,12 +270,9 @@ function getSchemaForTypedef(typedef, options = {}) {
270
270
  if (typedef.default) {
271
271
  // Note that adding a default in the validation is
272
272
  // technically unnecessary as this will be handled
273
- // at the model level, however fixed values can be
274
- // reported to the OpenAPI definition to enrich
275
- // documentation.
276
- if (typeof typedef.default !== 'function') {
277
- schema = schema.default(typedef.default);
278
- }
273
+ // at the model level, however passing this on will
274
+ // enrich OpenAPI documentation.
275
+ schema = schema.default(typedef.default);
279
276
  }
280
277
  if (typedef.validate?.schema) {
281
278
  schema = schema.append(typedef.validate.schema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/model",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Bedrock utilities for model creation.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "lodash": "^4.17.21"
30
30
  },
31
31
  "peerDependencies": {
32
- "@bedrockio/yada": "^1.0.30",
32
+ "@bedrockio/yada": "^1.0.32",
33
33
  "mongoose": ">=6.9.0"
34
34
  },
35
35
  "devDependencies": {
@@ -37,7 +37,7 @@
37
37
  "@babel/core": "^7.20.12",
38
38
  "@babel/preset-env": "^7.20.2",
39
39
  "@bedrockio/prettier-config": "^1.0.2",
40
- "@bedrockio/yada": "^1.0.30",
40
+ "@bedrockio/yada": "^1.0.32",
41
41
  "@shelf/jest-mongodb": "^4.1.6",
42
42
  "babel-plugin-import-replacement": "^1.0.1",
43
43
  "eslint": "^8.33.0",
package/src/validation.js CHANGED
@@ -282,12 +282,9 @@ function getSchemaForTypedef(typedef, options = {}) {
282
282
  if (typedef.default) {
283
283
  // Note that adding a default in the validation is
284
284
  // technically unnecessary as this will be handled
285
- // at the model level, however fixed values can be
286
- // reported to the OpenAPI definition to enrich
287
- // documentation.
288
- if (typeof typedef.default !== 'function') {
289
- schema = schema.default(typedef.default);
290
- }
285
+ // at the model level, however passing this on will
286
+ // enrich OpenAPI documentation.
287
+ schema = schema.default(typedef.default);
291
288
  }
292
289
  if (typedef.validate?.schema) {
293
290
  schema = schema.append(typedef.validate.schema);
@@ -24,6 +24,11 @@ export const INCLUDE_FIELD_SCHEMA: {
24
24
  validate(value: any, options?: {}): Promise<any>;
25
25
  clone(meta: any): any;
26
26
  toOpenApi(extra: any): any;
27
+ getDefault(): {
28
+ default?: undefined;
29
+ } | {
30
+ default: any;
31
+ };
27
32
  inspect(): string;
28
33
  expandExtra(extra?: {}): {};
29
34
  assertEnum(set: any, allow: any): any;
@@ -1 +1 @@
1
- {"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAuEC;AAMD,uDA4BC;AAGD,2DAIC;AAvHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKG"}
1
+ {"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAuEC;AAMD,uDA4BC;AAGD,2DAIC;AAvHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKG"}
package/types/search.d.ts CHANGED
@@ -22,6 +22,11 @@ export function searchValidation(options?: {}): {
22
22
  validate(value: any, options?: {}): Promise<any>;
23
23
  clone(meta: any): any;
24
24
  toOpenApi(extra: any): any;
25
+ getDefault(): {
26
+ default?: undefined;
27
+ } | {
28
+ default: any;
29
+ };
25
30
  inspect(): string;
26
31
  expandExtra(extra?: {}): {};
27
32
  assertEnum(set: any, allow: any): any;
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAcA,gEAgEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAcA,gEAgEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBC"}
@@ -83,6 +83,11 @@ export const OBJECT_ID_SCHEMA: {
83
83
  clone(meta: any): any;
84
84
  append(schema: any): any;
85
85
  toOpenApi(extra: any): any;
86
+ getDefault(): {
87
+ default?: undefined;
88
+ } | {
89
+ default: any;
90
+ };
86
91
  inspect(): string;
87
92
  expandExtra(extra?: {}): {};
88
93
  assertEnum(set: any, allow: any): any;
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAiFA,kDAEC;AAED,oEAiFC;AAsBD,wEAkBC;AAoRD;;;EAEC;AAED;;;EAOC;AA3dD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQK"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAiFA,kDAEC;AAED,oEAiFC;AAsBD,wEAkBC;AAiRD;;;EAEC;AAED;;;EAOC;AAxdD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQK"}