Skip to content

Commit

Permalink
add: api method getSchemaNode
Browse files Browse the repository at this point in the history
  • Loading branch information
sagold committed Apr 12, 2024
1 parent 9bd9ba8 commit 1e36606
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/draft/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,15 @@ export class Draft {
* @return resolved json-schema object of requested json-pointer location
*/
getSchema(options?: GetSchemaOptions): JsonSchema | JsonError | undefined {
return this.config.getSchema(this, options).schema;
const result = this.getSchemaNode(options);
if (isSchemaNode(result)) {
return result.schema;
}
return result;
}

getSchemaNode(options?: GetSchemaOptions): SchemaNode | JsonError | undefined {
return this.config.getSchema(this, options);
}

/**
Expand Down

0 comments on commit 1e36606

Please sign in to comment.