@travetto/schema
Advanced tools
Comparing version 5.0.0 to 5.0.1
{ | ||
"name": "@travetto/schema", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Data type registry for runtime validation, reflection and binding.", | ||
@@ -30,6 +30,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/registry": "^5.0.0" | ||
"@travetto/registry": "^5.0.1" | ||
}, | ||
"peerDependencies": { | ||
"@travetto/transformer": "^5.0.0" | ||
"@travetto/transformer": "^5.0.1" | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependenciesMeta": { |
@@ -461,4 +461,20 @@ import { Class, AppError, describeFunction, castTo, classConstruct, asFull, castKey } from '@travetto/runtime'; | ||
} | ||
/** | ||
* Visit fields recursively | ||
*/ | ||
visitFields<T>(cls: Class<T>, onField: (field: FieldConfig, path: FieldConfig[]) => void, _path: FieldConfig[] = [], root = cls): void { | ||
const fields = this.has(cls) ? | ||
Object.values(this.getViewSchema(cls).schema) : | ||
[]; | ||
for (const field of fields) { | ||
if (this.has(field.type)) { | ||
this.visitFields(field.type, onField, [..._path, field], root); | ||
} else { | ||
onField(field, _path); | ||
} | ||
} | ||
} | ||
} | ||
export const SchemaRegistry = new $SchemaRegistry(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102551
2351
Updated@travetto/registry@^5.0.1