(data, schema)
| 706 | } |
| 707 | |
| 708 | getReferencedModel (data, schema) { |
| 709 | if (schema.links == null) { return null } |
| 710 | const linkObject = _.find(schema.links, { rel: 'db' }) |
| 711 | if (!linkObject) { return null } |
| 712 | if (linkObject.href.match('thang.type') && !CocoModel.isObjectID(data)) { return null } // Skip loading hardcoded Thang Types for now (TODO) |
| 713 | |
| 714 | // not fully extensible, but we can worry about that later |
| 715 | let link = linkObject.href |
| 716 | link = link.replace('{(original)}', data.original) |
| 717 | link = link.replace('{(majorVersion)}', '' + (data.majorVersion != null ? data.majorVersion : 0)) |
| 718 | link = link.replace('{($)}', data) |
| 719 | return this.getOrMakeModelFromLink(link, linkObject) |
| 720 | } |
| 721 | |
| 722 | getOrMakeModelFromLink (link, linkObj) { |
| 723 | let Model |
no test coverage detected