@@ -396,7 +396,6 @@ describe('PlaceholderProcessor', () => {
|
||||
const processor = new PlaceholderProcessor({
|
||||
resolvers: {
|
||||
merge: async ({ value }) => {
|
||||
console.log({ value });
|
||||
if (value instanceof Object) {
|
||||
return { merged: 'value', ...value };
|
||||
}
|
||||
|
||||
@@ -111,15 +111,19 @@ export class PlaceholderProcessor implements CatalogProcessor {
|
||||
const resolverValue = data[keys[0]];
|
||||
|
||||
const resolver = this.options.resolvers[resolverKey];
|
||||
if (!resolver || typeof resolverValue !== 'string') {
|
||||
// If there was no such placeholder resolver or if the value was not a
|
||||
// string, we err on the side of safety and assume that this is
|
||||
// something that's best left alone. For example, if the input contains
|
||||
// JSONSchema, there may be "$ref": "#/definitions/node" nodes in the
|
||||
// document.
|
||||
if (!resolver) {
|
||||
// If there was no such placeholder resolver, we err on the side of safety
|
||||
// and assume that this is something that's best left alone. For example, if
|
||||
// the input contains JSONSchema, there may be "$ref": "#/definitions/node"
|
||||
// nodes in the document.
|
||||
return [data, false];
|
||||
}
|
||||
|
||||
// if (typeof resolverValue !== 'string') {
|
||||
// treat it as an argument to resolver function
|
||||
// TODO: make this recursive, but it should resolve from bottom up
|
||||
// }
|
||||
|
||||
const read = async (url: string): Promise<Buffer> => {
|
||||
if (this.options.reader.readUrl) {
|
||||
const response = await this.options.reader.readUrl(url);
|
||||
|
||||
Reference in New Issue
Block a user