diff --git a/lib/manifest.js b/lib/manifest.js index fa3860efd..9d70b6f10 100755 --- a/lib/manifest.js +++ b/lib/manifest.js @@ -197,7 +197,7 @@ exports.describe = function (schema) { normalized = mapped; } - description[inner] = normalized; + description[inner] = inner === 'link' ? normalized[0] : normalized; } return description; diff --git a/lib/types/link.js b/lib/types/link.js index eddab6530..92ebe80a5 100755 --- a/lib/types/link.js +++ b/lib/types/link.js @@ -25,13 +25,13 @@ internals.Link = class extends Any { Hoek.assert(ref.ancestor > 0, 'Link cannot reference itself'); const obj = this.clone(); - obj._inners._link = [{ ref }]; + obj._inners.link = [{ ref }]; return obj; } _base(value, state, prefs) { - const ref = this._inners._link[0].ref; + const ref = this._inners.link[0].ref; const perspective = state.schemas[ref.ancestor]; if (!perspective) { return { value, errors: this.createError('link.depth', value, { ref }, state, prefs) }; @@ -51,15 +51,6 @@ internals.Link = class extends Any { return schema._validate(value, state, prefs); } - // About - - describe() { - - const description = super.describe(); - description.link = { ref: this._inners._link[0].ref.describe() }; - return description; - } - // Helpers concat(source) { @@ -72,12 +63,12 @@ internals.Link = class extends Any { when(...args) { - const ref = this._inners._link[0].ref.clone(); + const ref = this._inners.link[0].ref.clone(); ++ref.ancestor; ref.updateDisplay(); const obj = this.clone(); - obj._inners._link = [{ ref }]; + obj._inners.link = [{ ref }]; return super.when.call(obj, ...args); } };