Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lookup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ export class InternalLookup implements Lookup {
return undefined;
}

const result = pointerGet(this.schema, ref.slice(1));
let result = pointerGet(this.schema, ref.slice(1));

if (result === undefined) {
return undefined;
}

// reference schema exists, add description from original schema if one exists
// fulfills scenario where schema property is a schema ref but also specifies a "top-level" description for the ref schema IE context description
result = {description: schema.description, ...result};

// TODO add in a type check on the result to ensure that it is of the right type

const subResult = this.getSchema(result);
Expand All @@ -81,4 +85,4 @@ export class InternalLookup implements Lookup {
baseReference: subResult.baseReference || ref
};
}
}
}