Skip to content

Use description from properties when building a property from reference #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
};
}
}
}