AdaptFrameworkImport.extractAssets() manually recurses through schema properties and data to find Asset-type fields and remap their values via this.assetMap. This duplicates the traversal logic already provided by Schema.walk().
The call site already has a schema instance:
this.extractAssets(schema.built.properties, insertData)
Could be refactored to:
extractAssets (schema, data) {
if (!schema) return
const matches = schema.walk(data, field =>
field?._backboneForms?.type === 'Asset' || field?._backboneForms === 'Asset'
)
matches.forEach(({ data: parent, key, value }) => {
value !== '' ? parent[key] = this.assetMap[value] ?? value : delete parent[key]
})
}
This eliminates the manual recursion and uses the shared schema walking infrastructure.
See also: adapt-security/adapt-authoring-courseassets#40 (same pattern for extractAssetIds)