function compile(tree, proto, prefix, options) {
  Document = Document || require('../../document');
  const typeKey = options.typeKey;

  for (const key of Object.keys(tree)) {
    const limb = tree[key];

    const hasSubprops = isPOJO(limb) &&
      Object.keys(limb).length > 0 &&
      (!limb[typeKey] || (typeKey === 'type' && isPOJO(limb.type) && limb.type.type));
    const subprops = hasSubprops ? limb : null;

    defineKey({ prop: key, subprops: subprops, prototype: proto, prefix: prefix, options: options });
  }
}
Compiles schemas.
@param {Object} tree
@param {Any} proto
@param {String} prefix
@param {Object} options
@api private