Permalink
Browse files

fix(entity-schema): use orm-data metadata to extend element defnition

  • Loading branch information...
bas080
bas080 committed Jun 30, 2016
1 parent 1d981fe commit 9c7eeeed43924792d1d8238b6db9bee7a3e35c67
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/entity-schema.js
@@ -17,17 +17,25 @@ export function entitySchema(entity) {
let schema = [];

for (let key of Object.keys(entity)) {
if (key === '__validationReporter__') {continue;} /* should be fixed in orm */
/* should be fixed in orm */
if (key === '__validationReporter__') {
continue;
}

let element = {
key: key,
key : key,
type: types[key]
};

element = extend(true, element, data[key].form || {});
element = extend(true, element, data[key] ? data[key].form || {} : {});

if (associations[key]) {
element.key = key;
element.resource = associations[key].entity;
}

if (associations[key] && associations[key].type === 'collection') {
element.type = 'collection';
element.type = 'collection';
element.schema = entitySchema(entityManager.getEntity(key));
}

0 comments on commit 9c7eeee

Please sign in to comment.