mirror of https://github.com/grpc/grpc-node.git
proto-loader: fromJSON add options
This commit is contained in:
parent
bdd8e1a110
commit
1143867682
|
@ -396,11 +396,16 @@ export function loadSync(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fromJSON(
|
export function fromJSON(
|
||||||
json: Protobuf.INamespace
|
json: Protobuf.INamespace,
|
||||||
|
options?: Options
|
||||||
): PackageDefinition {
|
): PackageDefinition {
|
||||||
|
options = options || {};
|
||||||
|
if (!!options.includeDirs) {
|
||||||
|
throw new Error('The fromJSON does not need to load any files, checkout your options');
|
||||||
|
}
|
||||||
const loadedRoot = Protobuf.Root.fromJSON(json);
|
const loadedRoot = Protobuf.Root.fromJSON(json);
|
||||||
loadedRoot.resolveAll();
|
loadedRoot.resolveAll();
|
||||||
return createPackageDefinition(loadedRoot, {});
|
return createPackageDefinition(loadedRoot, options!);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadFileDescriptorSetFromBuffer(
|
export function loadFileDescriptorSetFromBuffer(
|
||||||
|
|
Loading…
Reference in New Issue