@travetto/schema 2.1.2 → 2.1.5
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/package.json +3 -3
- package/src/bind-util.ts +1 -1
- package/src/service/registry.ts +2 -2
- package/support/transform-util.ts +4 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/schema",
|
|
3
3
|
"displayName": "Schema",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.5",
|
|
5
5
|
"description": "Data type registry for runtime validation, reflection and binding. ",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"schema",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"directory": "module/schema"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@travetto/registry": "^2.1.
|
|
33
|
-
"@travetto/transformer": "^2.1.
|
|
32
|
+
"@travetto/registry": "^2.1.5",
|
|
33
|
+
"@travetto/transformer": "^2.1.4"
|
|
34
34
|
},
|
|
35
35
|
"optionalPeerDependencies": {
|
|
36
36
|
"@types/faker": "^5.5.9",
|
package/src/bind-util.ts
CHANGED
|
@@ -273,7 +273,7 @@ export class BindUtil {
|
|
|
273
273
|
* @param params
|
|
274
274
|
* @returns
|
|
275
275
|
*/
|
|
276
|
-
static
|
|
276
|
+
static coerceFields(fields: FieldConfig[], params: unknown[], applyDefaults = false): unknown[] {
|
|
277
277
|
params = [...params];
|
|
278
278
|
// Coerce types
|
|
279
279
|
for (const el of fields) {
|
package/src/service/registry.ts
CHANGED
|
@@ -196,8 +196,8 @@ class $SchemaRegistry extends MetadataRegistry<ClassConfig, FieldConfig> {
|
|
|
196
196
|
* @param params
|
|
197
197
|
* @returns
|
|
198
198
|
*/
|
|
199
|
-
|
|
200
|
-
return BindUtil.
|
|
199
|
+
coerceMethodParams<T>(cls: Class<T>, method: string, params: unknown[], applyDefaults = false): unknown[] {
|
|
200
|
+
return BindUtil.coerceFields(this.getMethodSchema(cls, method), params, applyDefaults);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
/**
|